Diff for /libaitcfg/src/pq.c between versions 1.3 and 1.3.2.2

version 1.3, 2013/01/17 13:27:39 version 1.3.2.2, 2013/05/26 20:11:53
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 57  _selectPasswd(pwd_root_t * __restrict pwd, u_int uid,  Line 57  _selectPasswd(pwd_root_t * __restrict pwd, u_int uid, 
                 memset(&fu, 0, sizeof fu);                  memset(&fu, 0, sizeof fu);
   
         if (csName) {          if (csName) {
                io_setlikeVar(&fu.usr_name, string, strlen(csName) + 1, csName);                ait_setlikeVar(&fu.usr_name, string, strlen(csName) + 1, csName);
                 return RB_FIND(tagPWD, pwd, &fu);                  return RB_FIND(tagPWD, pwd, &fu);
         }          }
   
Line 103  cfg_findPasswdBy(pwd_root_t * __restrict pwd, int crit Line 103  cfg_findPasswdBy(pwd_root_t * __restrict pwd, int crit
         SLIST_FOREACH(u, pwd, usr_next)          SLIST_FOREACH(u, pwd, usr_next)
                 switch (criteria) {                  switch (criteria) {
                         case PWD_CRIT_NAME:                          case PWD_CRIT_NAME:
                                if (!io_cmpVar(&u->usr_name, &v)) {                                if (!ait_cmpVar(&u->usr_name, &v)) {
                                         AIT_FREE_VAL(&v);                                          AIT_FREE_VAL(&v);
                                         return u;                                          return u;
                                 }                                  }
Line 187  cfg_unsetPasswd(pwd_root_t * __restrict pwd, int crite Line 187  cfg_unsetPasswd(pwd_root_t * __restrict pwd, int crite
         AIT_FREE_VAL(&u->usr_realm);          AIT_FREE_VAL(&u->usr_realm);
         AIT_FREE_VAL(&u->usr_home);          AIT_FREE_VAL(&u->usr_home);
         AIT_FREE_VAL(&u->usr_shell);          AIT_FREE_VAL(&u->usr_shell);
        io_free(u);        e_free(u);
         return 1;          return 1;
 }  }
   
Line 221  cfg_setPasswd(pwd_root_t * __restrict pwd, passwd_attr Line 221  cfg_setPasswd(pwd_root_t * __restrict pwd, passwd_attr
         u = _selectPasswd(pwd, 0, csName);          u = _selectPasswd(pwd, 0, csName);
         if (!u) {          if (!u) {
                 /* adding new element */                  /* adding new element */
                u = io_malloc(sizeof(struct tagUser));                u = e_malloc(sizeof(struct tagUser));
                 if (!u) {                  if (!u) {
                        cfg_SetErr(io_GetErrno(), "%s", io_GetError());                        cfg_SetErr(elwix_GetErrno(), "%s", elwix_GetError());
                         return -1;                          return -1;
                 } else {                  } else {
                         memset(u, 0, sizeof(struct tagUser));                          memset(u, 0, sizeof(struct tagUser));
Line 274  cfg_setPasswd(pwd_root_t * __restrict pwd, passwd_attr Line 274  cfg_setPasswd(pwd_root_t * __restrict pwd, passwd_attr
                 va_end(lst);                  va_end(lst);
   
                 AIT_KEY(&u->usr_name) = crcFletcher16(AIT_GET_LIKE(&u->usr_name, u_short*),                   AIT_KEY(&u->usr_name) = crcFletcher16(AIT_GET_LIKE(&u->usr_name, u_short*), 
                                io_align(AIT_LEN(&u->usr_name) - 1, 2) / 2);                                E_ALIGN(AIT_LEN(&u->usr_name) - 1, 2) / 2);
   
                 PWD_LOCK(pwd);                  PWD_LOCK(pwd);
                 RB_INSERT(tagPWD, pwd, u);                  RB_INSERT(tagPWD, pwd, u);
Line 339  cfg_setPasswd(pwd_root_t * __restrict pwd, passwd_attr Line 339  cfg_setPasswd(pwd_root_t * __restrict pwd, passwd_attr
  * @arg1 = Username | UID   * @arg1 = Username | UID
  * return: NULL item not found, !=NULL structure found   * return: NULL item not found, !=NULL structure found
  */   */
inline const struct tagUser *const struct tagUser *
 cfg_getPasswd(pwd_root_t * __restrict pwd, int criteria, ...)  cfg_getPasswd(pwd_root_t * __restrict pwd, int criteria, ...)
 {  {
         struct tagUser *u;          struct tagUser *u;

Removed from v.1.3  
changed lines
  Added in v.1.3.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>