version 1.1.2.7, 2012/09/19 12:35:10
|
version 1.1.2.8, 2012/09/19 13:02:58
|
Line 184 cfg_unsetPasswd(pwd_root_t * __restrict pwd, int crite
|
Line 184 cfg_unsetPasswd(pwd_root_t * __restrict pwd, int crite
|
* @cfg = Password root |
* @cfg = Password root |
* @fields = Meaning continuous field |
* @fields = Meaning continuous field |
* @csName = Username |
* @csName = Username |
* @csPass = Password | * @arg1 = Password |
* @uid = UID | * @arg2 = UID |
* @gid = GID | * @arg3 = GID |
* @Class = Login class | * @arg4 = Login class |
* @change = Chage date | * @arg5 = Chage date |
* @expire = Expire date | * @arg6 = Expire date |
* @csRealm = Realm | * @arg7 = Realm |
* @csHome = Home dir | * @arg8 = Home dir |
* @csShell = Shell | * @arg9 = Shell |
* return: 0 nothing changed, -1 error, 1 found and updated item or 2 added new item |
* return: 0 nothing changed, -1 error, 1 found and updated item or 2 added new item |
*/ |
*/ |
int |
int |
cfg_setPasswd(pwd_root_t * __restrict pwd, u_char fields, const char *csName, const char *csPass, | cfg_setPasswd(pwd_root_t * __restrict pwd, u_char fields, const char *csName, ...) |
u_int uid, u_int gid, const char *csClass, u_int change, u_int expire, | |
const char *csRealm, const char *csHome, const char *csShell) | |
{ |
{ |
struct tagUser *u; |
struct tagUser *u; |
|
register int i; |
|
va_list lst; |
|
|
if (!pwd || !csName) |
if (!pwd || !csName) |
return -1; |
return -1; |
Line 224 cfg_setPasswd(pwd_root_t * __restrict pwd, u_char fiel
|
Line 224 cfg_setPasswd(pwd_root_t * __restrict pwd, u_char fiel
|
PWD_UNLOCK(pwd); |
PWD_UNLOCK(pwd); |
} |
} |
|
|
AIT_SET_STR(&u->usr_name, csName); | va_start(lst, csName); |
AIT_SET_STR(&u->usr_pass, csPass); | for (i = 0; i < (u->usr_fields + 1); i++) |
AIT_SET_U32(&u->usr_uid, uid); | switch (i) { |
AIT_SET_U32(&u->usr_gid, gid); | case 0: |
AIT_SET_STR(&u->usr_class, csClass); | AIT_SET_STR(&u->usr_name, va_arg(lst, char*)); |
AIT_SET_U32(&u->usr_change, change); | break; |
AIT_SET_U32(&u->usr_expire, expire); | case 1: |
AIT_SET_STR(&u->usr_realm, csRealm); | AIT_SET_STR(&u->usr_pass, va_arg(lst, char*)); |
AIT_SET_STR(&u->usr_home, csHome); | break; |
AIT_SET_STR(&u->usr_shell, csShell); | case 2: |
| AIT_SET_U32(&u->usr_uid, va_arg(lst, u_int)); |
| break; |
| case 3: |
| AIT_SET_U32(&u->usr_gid, va_arg(lst, u_int)); |
| break; |
| case 4: |
| AIT_SET_STR(&u->usr_class, va_arg(lst, char*)); |
| break; |
| case 5: |
| AIT_SET_U32(&u->usr_change, va_arg(lst, u_int)); |
| break; |
| case 6: |
| AIT_SET_U32(&u->usr_expire, va_arg(lst, u_int)); |
| break; |
| case 7: |
| AIT_SET_STR(&u->usr_realm, va_arg(lst, char*)); |
| break; |
| case 8: |
| AIT_SET_STR(&u->usr_home, va_arg(lst, char*)); |
| break; |
| case 9: |
| AIT_SET_STR(&u->usr_shell, va_arg(lst, char*)); |
| break; |
| } |
| 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); |
io_align(AIT_LEN(&u->usr_name) - 1, 2) / 2); |
Line 254 cfg_setPasswd(pwd_root_t * __restrict pwd, u_char fiel
|
Line 279 cfg_setPasswd(pwd_root_t * __restrict pwd, u_char fiel
|
AIT_FREE_VAL(&u->usr_shell); |
AIT_FREE_VAL(&u->usr_shell); |
|
|
/* Update element */ |
/* Update element */ |
AIT_SET_STR(&u->usr_pass, csPass); | va_start(lst, csName); |
AIT_SET_U32(&u->usr_uid, uid); | for (i = 1; i < (u->usr_fields + 1); i++) |
AIT_SET_U32(&u->usr_gid, gid); | switch (i) { |
AIT_SET_STR(&u->usr_class, csClass); | case 1: |
AIT_SET_U32(&u->usr_change, change); | AIT_SET_STR(&u->usr_pass, va_arg(lst, char*)); |
AIT_SET_U32(&u->usr_expire, expire); | break; |
AIT_SET_STR(&u->usr_realm, csRealm); | case 2: |
AIT_SET_STR(&u->usr_home, csHome); | AIT_SET_U32(&u->usr_uid, va_arg(lst, u_int)); |
AIT_SET_STR(&u->usr_shell, csShell); | break; |
| case 3: |
| AIT_SET_U32(&u->usr_gid, va_arg(lst, u_int)); |
| break; |
| case 4: |
| AIT_SET_STR(&u->usr_class, va_arg(lst, char*)); |
| break; |
| case 5: |
| AIT_SET_U32(&u->usr_change, va_arg(lst, u_int)); |
| break; |
| case 6: |
| AIT_SET_U32(&u->usr_expire, va_arg(lst, u_int)); |
| break; |
| case 7: |
| AIT_SET_STR(&u->usr_realm, va_arg(lst, char*)); |
| break; |
| case 8: |
| AIT_SET_STR(&u->usr_home, va_arg(lst, char*)); |
| break; |
| case 9: |
| AIT_SET_STR(&u->usr_shell, va_arg(lst, char*)); |
| break; |
| } |
| va_end(lst); |
return 1; |
return 1; |
} |
} |
|
|