nsswitch/winbind_nss_aix.c

ソースコードを見る。

関数

static void logit (const char *format,...)
static void free_pwd (struct passwd *pwd)
static void free_grp (struct group *grp)
static void replace_commas (char *s)
static unsigned decode_id (const char *name)
static struct passwd * wb_aix_getpwuid (uid_t uid)
static char * decode_user (const char *name)
static struct passwd * fill_pwent (struct winbindd_pw *pw)
static struct group * fill_grent (struct winbindd_gr *gr, char *gr_mem)
static struct group * wb_aix_getgrgid (gid_t gid)
static struct group * wb_aix_getgrnam (const char *name)
static struct group * wb_aix_getgracct (void *id, int type)
static char * wb_aix_getgrset (char *user)
static struct passwd * wb_aix_getpwnam (const char *name)
static int wb_aix_lsuser (char *attributes[], attrval_t results[], int size)
static int wb_aix_lsgroup (char *attributes[], attrval_t results[], int size)
static attrval_t pwd_to_group (struct passwd *pwd)
static attrval_t pwd_to_groupsids (struct passwd *pwd)
static attrval_t pwd_to_sid (struct passwd *pwd)
static int wb_aix_user_attrib (const char *key, char *attributes[], attrval_t results[], int size)
static int wb_aix_group_attrib (const char *key, char *attributes[], attrval_t results[], int size)
static int wb_aix_getentry (char *key, char *table, char *attributes[], attrval_t results[], int size)
static void * wb_aix_open (const char *name, const char *domain, int mode, char *options)
static void wb_aix_close (void *token)
static attrlist_t ** wb_aix_attrlist (void)
static int wb_aix_normalize (char *longname, char *shortname)
static int wb_aix_authenticate (char *user, char *pass, int *reenter, char **message)
static int wb_aix_chpass (char *user, char *oldpass, char *newpass, char **message)
static int wb_aix_passwdrestrictions (char *user, char *newpass, char *oldpass, char **message)
static int wb_aix_passwdexpired (char *user, char **message)
static char * wb_aix_getpasswd (char *user)
static int wb_aix_putentry (char *key, char *table, char *attributes[], attrval_t values[], int size)
static int wb_aix_commit (char *key, char *table)
static int wb_aix_getgrusers (char *group, void *result, int type, int *size)
 DECL_METHOD (delgroup)
 DECL_METHOD (deluser)
 DECL_METHOD (newgroup)
 DECL_METHOD (newuser)
 DECL_METHOD (putgrent)
 DECL_METHOD (putgrusers)
 DECL_METHOD (putpwent)
 DECL_METHOD (lock)
 DECL_METHOD (unlock)
 DECL_METHOD (getcred)
 DECL_METHOD (setcred)
 DECL_METHOD (deletecred)
int wb_aix_init (struct secmethod_table *methods)

変数

static int debug_enabled


関数

static void logit ( const char *  format,
  ... 
) [static]

winbind_nss_aix.c61 行で定義されています。

参照先 debug_enabled.

参照元 decode_user()wb_aix_attrlist()wb_aix_authenticate()wb_aix_chpass()wb_aix_close()wb_aix_commit()wb_aix_getentry()wb_aix_getgrgid()wb_aix_getgrnam()wb_aix_getgrset()wb_aix_getgrusers()wb_aix_getpasswd()wb_aix_getpwnam()wb_aix_getpwuid()wb_aix_group_attrib()wb_aix_lsgroup()wb_aix_lsuser()wb_aix_normalize()wb_aix_open()wb_aix_passwdexpired()wb_aix_passwdrestrictions()wb_aix_putentry()wb_aix_user_attrib().

00062 {
00063         va_list ap;
00064         FILE *f;
00065         if (!debug_enabled) {
00066                 return;
00067         }
00068         f = fopen("/tmp/WINBIND_DEBUG.log", "a");
00069         if (!f) return;
00070         va_start(ap, format);
00071         vfprintf(f, format, ap);
00072         va_end(ap);
00073         fclose(f);
00074 }

static void free_pwd ( struct passwd *  pwd  )  [static]

winbind_nss_aix.c101 行で定義されています。

参照元 decode_user()wb_aix_normalize()wb_aix_user_attrib().

00102 {
00103         free(pwd->pw_name);
00104         free(pwd->pw_passwd);
00105         free(pwd->pw_gecos);
00106         free(pwd->pw_dir);
00107         free(pwd->pw_shell);
00108         free(pwd);
00109 }

static void free_grp ( struct group *  grp  )  [static]

winbind_nss_aix.c112 行で定義されています。

参照元 pwd_to_group()wb_aix_group_attrib().

00113 {
00114         int i;
00115 
00116         free(grp->gr_name);
00117         free(grp->gr_passwd);
00118         
00119         if (!grp->gr_mem) {
00120                 free(grp);
00121                 return;
00122         }
00123         
00124         for (i=0; grp->gr_mem[i]; i++) {
00125                 free(grp->gr_mem[i]);
00126         }
00127 
00128         free(grp->gr_mem);
00129         free(grp);
00130 }

static void replace_commas ( char *  s  )  [static]

winbind_nss_aix.c134 行で定義されています。

参照元 pwd_to_groupsids()wb_aix_lsgroup()wb_aix_lsuser().

00135 {
00136         char *p, *p0=s;
00137         for (p=strchr(s, ','); p; p = strchr(p+1, ',')) {
00138                 *p=0;
00139                 p0 = p+1;
00140         }
00141 
00142         p0[strlen(p0)+1] = 0;
00143 }

static unsigned decode_id ( const char *  name  )  [static]

winbind_nss_aix.c155 行で定義されています。

参照先 id.

参照元 wb_aix_getgrnam()wb_aix_getpwnam().

00156 {
00157         unsigned id;
00158         sscanf(name+1, "%u", &id);
00159         return id;
00160 }

static struct passwd * wb_aix_getpwuid ( uid_t  uid  )  [static]

winbind_nss_aix.c397 行で定義されています。

参照先 winbindd_response::datawinbindd_request::datafill_pwent()free_response()logit()winbindd_response::pwwinbindd_request::uidWINBINDD_GETPWUIDwinbindd_request_response().

参照元 decode_user()wb_aix_getpwnam()wb_aix_init().

00398 {
00399         struct winbindd_response response;
00400         struct winbindd_request request;
00401         NSS_STATUS ret;
00402         struct passwd *pwd;
00403 
00404         logit("getpwuid '%d'\n", uid);
00405 
00406         ZERO_STRUCT(response);
00407         ZERO_STRUCT(request);
00408                 
00409         request.data.uid = uid;
00410         
00411         ret = winbindd_request_response(WINBINDD_GETPWUID, &request, &response);
00412 
00413         HANDLE_ERRORS(ret);
00414 
00415         pwd = fill_pwent(&response.data.pw);
00416 
00417         free_response(&response);
00418 
00419         logit("getpwuid gave ptr %p\n", pwd);
00420 
00421         return pwd;
00422 }

static char* decode_user ( const char *  name  )  [static]

winbind_nss_aix.c164 行で定義されています。

参照先 free_pwd()idlogit()strdup()wb_aix_getpwuid().

参照元 wb_aix_authenticate()wb_aix_chpass()wb_aix_getgrset().

00165 {
00166         struct passwd *pwd;
00167         unsigned id;
00168         char *ret;
00169 
00170         sscanf(name+1, "%u", &id);
00171         pwd = wb_aix_getpwuid(id);
00172         if (!pwd) {
00173                 return NULL;
00174         }
00175         ret = strdup(pwd->pw_name);
00176 
00177         free_pwd(pwd);
00178 
00179         logit("decoded '%s' -> '%s'\n", name, ret);
00180 
00181         return ret;
00182 }

static struct passwd* fill_pwent ( struct winbindd_pw pw  )  [static]

winbind_nss_aix.c188 行で定義されています。

参照先 errnowinbindd_pw::pw_dirwinbindd_pw::pw_gecoswinbindd_pw::pw_gidwinbindd_pw::pw_namewinbindd_pw::pw_passwdwinbindd_pw::pw_shellwinbindd_pw::pw_uidresultstrdup().

参照元 _nss_winbind_getpwent_r()_nss_winbind_getpwnam_r()_nss_winbind_getpwuid_r()wb_aix_getpwnam()wb_aix_getpwuid().

00189 {
00190         struct passwd *result;
00191 
00192         result = calloc(1, sizeof(struct passwd));
00193         if (!result) {
00194                 errno = ENOMEM;
00195                 return NULL;
00196         }
00197 
00198         result->pw_uid = pw->pw_uid;
00199         result->pw_gid = pw->pw_gid;
00200         result->pw_name   = strdup(pw->pw_name);
00201         result->pw_passwd = strdup(pw->pw_passwd);
00202         result->pw_gecos  = strdup(pw->pw_gecos);
00203         result->pw_dir    = strdup(pw->pw_dir);
00204         result->pw_shell  = strdup(pw->pw_shell);
00205         
00206         return result;
00207 }

static struct group* fill_grent ( struct winbindd_gr gr,
char *  gr_mem 
) [static]

winbind_nss_aix.c213 行で定義されています。

参照先 errnowinbindd_gr::gr_gidwinbindd_gr::gr_namewinbindd_gr::gr_passwdnamewinbindd_gr::num_gr_memresultstrdup().

参照元 _nss_winbind_getgrgid_r()_nss_winbind_getgrnam_r()getgrgid_got_sid()wb_aix_getgrgid()wb_aix_getgrnam()winbind_getgrent()winbindd_getgrent()winbindd_getgrnam().

00214 {
00215         int i;
00216         struct group *result;
00217         char *p, *name;
00218 
00219         result = calloc(1, sizeof(struct group));
00220         if (!result) {
00221                 errno = ENOMEM;
00222                 return NULL;
00223         }
00224 
00225         result->gr_gid = gr->gr_gid;
00226 
00227         result->gr_name   = strdup(gr->gr_name);
00228         result->gr_passwd = strdup(gr->gr_passwd);
00229 
00230         /* Group membership */
00231         if ((gr->num_gr_mem < 0) || !gr_mem) {
00232                 gr->num_gr_mem = 0;
00233         }
00234         
00235         if (gr->num_gr_mem == 0) {
00236                 /* Group is empty */            
00237                 return result;
00238         }
00239         
00240         result->gr_mem = (char **)malloc(sizeof(char *) * (gr->num_gr_mem+1));
00241         if (!result->gr_mem) {
00242                 errno = ENOMEM;
00243                 return NULL;
00244         }
00245 
00246         /* Start looking at extra data */
00247         i=0;
00248         for (name = strtok_r(gr_mem, ",", &p); 
00249              name; 
00250              name = strtok_r(NULL, ",", &p)) {
00251                 if (i == gr->num_gr_mem) {
00252                         break;
00253                 }
00254                 result->gr_mem[i] = strdup(name);
00255                 i++;
00256         }
00257 
00258         /* Terminate list */
00259         result->gr_mem[i] = NULL;
00260 
00261         return result;
00262 }

static struct group* wb_aix_getgrgid ( gid_t  gid  )  [static]

winbind_nss_aix.c267 行で定義されています。

参照先 winbindd_response::datawinbindd_request::datawinbindd_response::extra_datafill_grent()free_response()winbindd_request::gidwinbindd_response::grlogit()WINBINDD_GETGRGIDwinbindd_request_response().

参照元 pwd_to_group()wb_aix_getgracct()wb_aix_getgrnam()wb_aix_init().

00268 {
00269         struct winbindd_response response;
00270         struct winbindd_request request;
00271         struct group *grp;
00272         NSS_STATUS ret;
00273 
00274         logit("getgrgid %d\n", gid);
00275 
00276         ZERO_STRUCT(response);
00277         ZERO_STRUCT(request);
00278         
00279         request.data.gid = gid;
00280 
00281         ret = winbindd_request_response(WINBINDD_GETGRGID, &request, &response);
00282 
00283         logit("getgrgid ret=%d\n", ret);
00284 
00285         HANDLE_ERRORS(ret);
00286 
00287         grp = fill_grent(&response.data.gr, response.extra_data.data);
00288 
00289         free_response(&response);
00290 
00291         return grp;
00292 }

static struct group* wb_aix_getgrnam ( const char *  name  )  [static]

winbind_nss_aix.c295 行で定義されています。

参照先 winbindd_response::datawinbindd_request::datadecode_id()winbindd_response::extra_datafill_grent()free_response()winbindd_response::grwinbindd_request::groupnamelogit()wb_aix_getgrgid()WINBINDD_GETGRNAMwinbindd_request_response().

参照元 wb_aix_getgracct()wb_aix_group_attrib()wb_aix_init().

00296 {
00297         struct winbindd_response response;
00298         struct winbindd_request request;
00299         NSS_STATUS ret;
00300         struct group *grp;
00301 
00302         if (*name == WB_AIX_ENCODED) {
00303                 return wb_aix_getgrgid(decode_id(name));
00304         }
00305 
00306         logit("getgrnam '%s'\n", name);
00307 
00308         ZERO_STRUCT(response);
00309         ZERO_STRUCT(request);
00310 
00311         STRCPY_RETNULL(request.data.groupname, name);
00312 
00313         ret = winbindd_request_response(WINBINDD_GETGRNAM, &request, &response);
00314         
00315         HANDLE_ERRORS(ret);
00316 
00317         grp = fill_grent(&response.data.gr, response.extra_data.data);
00318 
00319         free_response(&response);
00320 
00321         return grp;
00322 }

static struct group* wb_aix_getgracct ( void *  id,
int  type 
) [static]

winbind_nss_aix.c327 行で定義されています。

参照先 errnowb_aix_getgrgid()wb_aix_getgrnam().

参照元 wb_aix_init().

00328 {
00329         if (type == 1) {
00330                 return wb_aix_getgrnam((char *)id);
00331         }
00332         if (type == 0) {
00333                 return wb_aix_getgrgid(*(int *)id);
00334         }
00335         errno = EINVAL;
00336         return NULL;
00337 }

static char* wb_aix_getgrset ( char *  user  )  [static]

winbind_nss_aix.c342 行で定義されています。

参照先 winbindd_response::datawinbindd_request::datadecode_user()errnowinbindd_response::extra_datafree_response()logit()winbindd_response::num_entriessprintf()tmpbufwinbindd_request::usernameWINBINDD_GETGROUPSwinbindd_request_response().

参照元 pwd_to_groupsids()wb_aix_init().

00343 {
00344         struct winbindd_response response;
00345         struct winbindd_request request;
00346         NSS_STATUS ret;
00347         int i, idx;
00348         char *tmpbuf;
00349         int num_gids;
00350         gid_t *gid_list;
00351         char *r_user = user;
00352 
00353         if (*user == WB_AIX_ENCODED) {
00354                 r_user = decode_user(r_user);
00355                 if (!r_user) {
00356                         errno = ENOENT;
00357                         return NULL;
00358                 }
00359         }
00360 
00361         logit("getgrset '%s'\n", r_user);
00362 
00363         ZERO_STRUCT(response);
00364         ZERO_STRUCT(request);
00365 
00366         STRCPY_RETNULL(request.data.username, r_user);
00367 
00368         if (*user == WB_AIX_ENCODED) {
00369                 free(r_user);
00370         }
00371 
00372         ret = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response);
00373 
00374         HANDLE_ERRORS(ret);
00375 
00376         num_gids = response.data.num_entries;
00377         gid_list = (gid_t *)response.extra_data.data;
00378                 
00379         /* allocate a space large enough to contruct the string */
00380         tmpbuf = malloc(num_gids*12);
00381         if (!tmpbuf) {
00382                 return NULL;
00383         }
00384 
00385         for (idx=i=0; i < num_gids-1; i++) {
00386                 idx += sprintf(tmpbuf+idx, "%u,", gid_list[i]); 
00387         }
00388         idx += sprintf(tmpbuf+idx, "%u", gid_list[i]);  
00389 
00390         free_response(&response);
00391 
00392         return tmpbuf;
00393 }

static struct passwd* wb_aix_getpwnam ( const char *  name  )  [static]

winbind_nss_aix.c426 行で定義されています。

参照先 winbindd_response::datawinbindd_request::datadecode_id()fill_pwent()free_response()logit()winbindd_response::pwwinbindd_request::usernamewb_aix_getpwuid()WINBINDD_GETPWNAMwinbindd_request_response().

参照元 wb_aix_init()wb_aix_normalize()wb_aix_user_attrib().

00427 {
00428         struct winbindd_response response;
00429         struct winbindd_request request;
00430         NSS_STATUS ret;
00431         struct passwd *pwd;
00432 
00433         if (*name == WB_AIX_ENCODED) {
00434                 return wb_aix_getpwuid(decode_id(name));
00435         }
00436 
00437         logit("getpwnam '%s'\n", name);
00438 
00439         ZERO_STRUCT(response);
00440         ZERO_STRUCT(request);
00441 
00442         STRCPY_RETNULL(request.data.username, name);
00443 
00444         ret = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response);
00445 
00446         HANDLE_ERRORS(ret);
00447         
00448         pwd = fill_pwent(&response.data.pw);
00449 
00450         free_response(&response);
00451 
00452         logit("getpwnam gave ptr %p\n", pwd);
00453 
00454         return pwd;
00455 }

static int wb_aix_lsuser ( char *  attributes[],
attrval_t  results[],
int  size 
) [static]

winbind_nss_aix.c460 行で定義されています。

参照先 winbindd_response::dataerrnowinbindd_response::extra_datafree_response()lenlogit()replace_commas()WINBINDD_LIST_USERSwinbindd_request_response().

参照元 wb_aix_getentry().

00461 {
00462         NSS_STATUS ret;
00463         struct winbindd_request request;
00464         struct winbindd_response response;
00465         int len;
00466         char *s;
00467 
00468         if (size != 1 || strcmp(attributes[0], S_USERS) != 0) {
00469                 logit("invalid lsuser op\n");
00470                 errno = EINVAL;
00471                 return -1;
00472         }
00473 
00474         ZERO_STRUCT(request);
00475         ZERO_STRUCT(response);
00476         
00477         ret = winbindd_request_response(WINBINDD_LIST_USERS, &request, &response);
00478         if (ret != 0) {
00479                 errno = EINVAL;
00480                 return -1;
00481         }
00482 
00483         len = strlen(response.extra_data.data);
00484 
00485         s = malloc(len+2);
00486         if (!s) {
00487                 free_response(&response);
00488                 errno = ENOMEM;
00489                 return -1;
00490         }
00491         
00492         memcpy(s, response.extra_data.data, len+1);
00493 
00494         replace_commas(s);
00495 
00496         results[0].attr_un.au_char = s;
00497         results[0].attr_flag = 0;
00498 
00499         free_response(&response);
00500         
00501         return 0;
00502 }

static int wb_aix_lsgroup ( char *  attributes[],
attrval_t  results[],
int  size 
) [static]

winbind_nss_aix.c508 行で定義されています。

参照先 winbindd_response::dataerrnowinbindd_response::extra_datafree_response()lenlogit()replace_commas()WINBINDD_LIST_GROUPSwinbindd_request_response().

参照元 wb_aix_getentry().

00509 {
00510         NSS_STATUS ret;
00511         struct winbindd_request request;
00512         struct winbindd_response response;
00513         int len;
00514         char *s;
00515 
00516         if (size != 1 || strcmp(attributes[0], S_GROUPS) != 0) {
00517                 logit("invalid lsgroup op\n");
00518                 errno = EINVAL;
00519                 return -1;
00520         }
00521 
00522         ZERO_STRUCT(request);
00523         ZERO_STRUCT(response);
00524         
00525         ret = winbindd_request_response(WINBINDD_LIST_GROUPS, &request, &response);
00526         if (ret != 0) {
00527                 errno = EINVAL;
00528                 return -1;
00529         }
00530 
00531         len = strlen(response.extra_data.data);
00532 
00533         s = malloc(len+2);
00534         if (!s) {
00535                 free_response(&response);
00536                 errno = ENOMEM;
00537                 return -1;
00538         }
00539         
00540         memcpy(s, response.extra_data.data, len+1);
00541 
00542         replace_commas(s);
00543 
00544         results[0].attr_un.au_char = s;
00545         results[0].attr_flag = 0;
00546 
00547         free_response(&response);
00548         
00549         return 0;
00550 }

static attrval_t pwd_to_group ( struct passwd *  pwd  )  [static]

winbind_nss_aix.c553 行で定義されています。

参照先 free_grp()strdup()wb_aix_getgrgid().

参照元 wb_aix_user_attrib().

00554 {
00555         attrval_t r;
00556         struct group *grp = wb_aix_getgrgid(pwd->pw_gid);
00557         
00558         if (!grp) {
00559                 r.attr_flag = EINVAL;                           
00560         } else {
00561                 r.attr_flag = 0;
00562                 r.attr_un.au_char = strdup(grp->gr_name);
00563                 free_grp(grp);
00564         }
00565 
00566         return r;
00567 }

static attrval_t pwd_to_groupsids ( struct passwd *  pwd  )  [static]

winbind_nss_aix.c569 行で定義されています。

参照先 replace_commas()wb_aix_getgrset().

参照元 wb_aix_user_attrib().

00570 {
00571         attrval_t r;
00572         char *s, *p;
00573 
00574         if ( (s = wb_aix_getgrset(pwd->pw_name)) == NULL ) {
00575                 r.attr_flag = EINVAL;
00576                 return r;
00577         }
00578 
00579         if ( (p = malloc(strlen(s)+2)) == NULL ) {
00580                 r.attr_flag = ENOMEM;
00581                 return r;
00582         }
00583 
00584         strcpy(p, s);
00585         replace_commas(p);
00586         free(s);
00587 
00588         r.attr_un.au_char = p;
00589 
00590         return r;
00591 }

static attrval_t pwd_to_sid ( struct passwd *  pwd  )  [static]

winbind_nss_aix.c593 行で定義されています。

参照先 winbindd_response::datawinbindd_request::dataNSS_STATUS_SUCCESSwinbindd_response::sidstrdup()winbindd_request::uidwinbindd_request_response()WINBINDD_UID_TO_SID.

参照元 wb_aix_user_attrib().

00594 {
00595         struct winbindd_request request;
00596         struct winbindd_response response;
00597         attrval_t r;
00598 
00599         ZERO_STRUCT(request);
00600         ZERO_STRUCT(response);
00601 
00602         request.data.uid = pwd->pw_uid;
00603 
00604         if (winbindd_request_response(WINBINDD_UID_TO_SID, &request, &response) !=
00605             NSS_STATUS_SUCCESS) {
00606                 r.attr_flag = ENOENT;
00607         } else {
00608                 r.attr_flag = 0;
00609                 r.attr_un.au_char = strdup(response.data.sid.sid);
00610         }
00611 
00612         return r;
00613 }

static int wb_aix_user_attrib ( const char *  key,
char *  attributes[],
attrval_t  results[],
int  size 
) [static]

winbind_nss_aix.c615 行で定義されています。

参照先 endiferrnofree_pwd()logit()pwd_to_group()pwd_to_groupsids()pwd_to_sid()strdup()wb_aix_getpwnam().

参照元 wb_aix_getentry().

00617 {
00618         struct passwd *pwd;
00619         int i;
00620 
00621         pwd = wb_aix_getpwnam(key);
00622         if (!pwd) {
00623                 errno = ENOENT;
00624                 return -1;
00625         }
00626 
00627         for (i=0;i<size;i++) {
00628                 results[i].attr_flag = 0;
00629 
00630                 if (strcmp(attributes[i], S_ID) == 0) {
00631                         results[i].attr_un.au_int = pwd->pw_uid;
00632 #ifdef _AIXVERSION_530
00633                 } else if (strcmp(attributes[i], S_PGID) == 0) {
00634                         results[i].attr_un.au_int = pwd->pw_gid;
00635 #endif
00636                 } else if (strcmp(attributes[i], S_PWD) == 0) {
00637                         results[i].attr_un.au_char = strdup(pwd->pw_passwd);
00638                 } else if (strcmp(attributes[i], S_HOME) == 0) {
00639                         results[i].attr_un.au_char = strdup(pwd->pw_dir);
00640                 } else if (strcmp(attributes[i], S_SHELL) == 0) {
00641                         results[i].attr_un.au_char = strdup(pwd->pw_shell);
00642                 } else if (strcmp(attributes[i], S_REGISTRY) == 0) {
00643                         results[i].attr_un.au_char = strdup("WINBIND");
00644                 } else if (strcmp(attributes[i], S_GECOS) == 0) {
00645                         results[i].attr_un.au_char = strdup(pwd->pw_gecos);
00646                 } else if (strcmp(attributes[i], S_PGRP) == 0) {
00647                         results[i] = pwd_to_group(pwd);
00648                 } else if (strcmp(attributes[i], S_GROUPS) == 0) {
00649                         results[i] = pwd_to_groupsids(pwd);
00650                 } else if (strcmp(attributes[i], "SID") == 0) {
00651                         results[i] = pwd_to_sid(pwd);
00652                 } else {
00653                         logit("Unknown user attribute '%s'\n", attributes[i]);
00654                         results[i].attr_flag = EINVAL;
00655                 }
00656         }
00657 
00658         free_pwd(pwd);
00659 
00660         return 0;
00661 }

static int wb_aix_group_attrib ( const char *  key,
char *  attributes[],
attrval_t  results[],
int  size 
) [static]

winbind_nss_aix.c663 行で定義されています。

参照先 errnofree_grp()logit()strdup()wb_aix_getgrnam().

参照元 wb_aix_getentry().

00665 {
00666         struct group *grp;
00667         int i;
00668 
00669         grp = wb_aix_getgrnam(key);
00670         if (!grp) {
00671                 errno = ENOENT;
00672                 return -1;
00673         }
00674 
00675         for (i=0;i<size;i++) {
00676                 results[i].attr_flag = 0;
00677 
00678                 if (strcmp(attributes[i], S_PWD) == 0) {
00679                         results[i].attr_un.au_char = strdup(grp->gr_passwd);
00680                 } else if (strcmp(attributes[i], S_ID) == 0) {
00681                         results[i].attr_un.au_int = grp->gr_gid;
00682                 } else {
00683                         logit("Unknown group attribute '%s'\n", attributes[i]);
00684                         results[i].attr_flag = EINVAL;
00685                 }
00686         }
00687 
00688         free_grp(grp);
00689 
00690         return 0;
00691 }

static int wb_aix_getentry ( char *  key,
char *  table,
char *  attributes[],
attrval_t  results[],
int  size 
) [static]

winbind_nss_aix.c697 行で定義されています。

参照先 errnologit()wb_aix_group_attrib()wb_aix_lsgroup()wb_aix_lsuser()wb_aix_user_attrib().

参照元 wb_aix_init().

00699 {
00700         logit("Got getentry with key='%s' table='%s' size=%d attributes[0]='%s'\n", 
00701               key, table, size, attributes[0]);
00702 
00703         if (strcmp(key, "ALL") == 0 && 
00704             strcmp(table, "user") == 0) {
00705                 return wb_aix_lsuser(attributes, results, size);
00706         }
00707 
00708         if (strcmp(key, "ALL") == 0 && 
00709             strcmp(table, "group") == 0) {
00710                 return wb_aix_lsgroup(attributes, results, size);
00711         }
00712 
00713         if (strcmp(table, "user") == 0) {
00714                 return wb_aix_user_attrib(key, attributes, results, size);
00715         }
00716 
00717         if (strcmp(table, "group") == 0) {
00718                 return wb_aix_group_attrib(key, attributes, results, size);
00719         }
00720 
00721         logit("Unknown getentry operation key='%s' table='%s'\n", key, table);
00722 
00723         errno = ENOSYS;
00724         return -1;
00725 }

static void* wb_aix_open ( const char *  name,
const char *  domain,
int  mode,
char *  options 
) [static]

winbind_nss_aix.c732 行で定義されています。

参照先 debug_enabledlogit().

参照元 wb_aix_init().

00733 {
00734         if (strstr(options, "debug")) {
00735                 debug_enabled = 1;
00736         }
00737         logit("open name='%s' mode=%d domain='%s' options='%s'\n", name, domain, 
00738               mode, options);
00739         return NULL;
00740 }

static void wb_aix_close ( void *  token  )  [static]

winbind_nss_aix.c742 行で定義されています。

参照先 logit().

参照元 wb_aix_init().

00743 {
00744         logit("close\n");
00745         return;
00746 }

static attrlist_t** wb_aix_attrlist ( void   )  [static]

winbind_nss_aix.c752 行で定義されています。

参照先 errnoflagslogit()namesizestrdup()type.

参照元 wb_aix_init().

00753 {
00754         /* pretty confusing but we are allocating the array of pointers
00755            and the structures we'll be pointing to all at once.  So
00756            you need N+1 pointers and N structures. */
00757 
00758         attrlist_t **ret = NULL;
00759         attrlist_t *offset = NULL;
00760         int i;
00761         int n;
00762         size_t size;
00763 
00764         struct attr_types {
00765                 const char *name;
00766                 int flags;
00767                 int type;
00768         } attr_list[] = {
00769                 /* user attributes */
00770                 {S_ID,          AL_USERATTR,    SEC_INT},
00771                 {S_PGRP,        AL_USERATTR,    SEC_CHAR},
00772                 {S_HOME,        AL_USERATTR,    SEC_CHAR},
00773                 {S_SHELL,       AL_USERATTR,    SEC_CHAR},
00774 #ifdef _AIXVERSION_530
00775                 {S_PGID,        AL_USERATTR,    SEC_INT},
00776 #endif
00777                 {S_GECOS,       AL_USERATTR,    SEC_CHAR},
00778                 {S_SHELL,       AL_USERATTR,    SEC_CHAR},
00779                 {S_PGRP,        AL_USERATTR,    SEC_CHAR},
00780                 {S_GROUPS,      AL_USERATTR,    SEC_LIST},
00781                 {"SID",         AL_USERATTR,    SEC_CHAR},
00782 
00783                 /* group attributes */
00784                 {S_ID,          AL_GROUPATTR,   SEC_INT}
00785         };
00786 
00787         logit("method attrlist called\n");
00788 
00789         n = sizeof(attr_list) / sizeof(struct attr_types);
00790         size = (n*sizeof(attrlist_t *));
00791 
00792         if ( (ret = malloc( size )) == NULL ) {
00793                 errno = ENOMEM;
00794                 return NULL;
00795         }
00796 
00797         /* offset to where the structures start in the buffer */
00798 
00799         offset = (attrlist_t *)(ret + n);
00800 
00801         /* now loop over the user_attr_list[] array and add
00802            all the members */
00803 
00804         for ( i=0; i<n; i++ ) {
00805                 attrlist_t *a = malloc(sizeof(attrlist_t));
00806 
00807                 if ( !a ) {
00808                         /* this is bad.  Just bail */
00809                         return NULL;
00810                 }
00811 
00812                 a->al_name  = strdup(attr_list[i].name);
00813                 a->al_flags = attr_list[i].flags;
00814                 a->al_type  = attr_list[i].type;
00815 
00816                 ret[i] = a;
00817         }
00818         ret[n] = NULL;
00819 
00820         return ret;
00821 }

static int wb_aix_normalize ( char *  longname,
char *  shortname 
) [static]

winbind_nss_aix.c829 行で定義されています。

参照先 errnofree_pwd()logit()sprintf()wb_aix_getpwnam().

参照元 wb_aix_init().

00830 {
00831         struct passwd *pwd;
00832 
00833         logit("normalize '%s'\n", longname);
00834 
00835         /* automatically cope with AIX 5.3 with longer usernames
00836            when it comes out */
00837         if (S_NAMELEN > strlen(longname)) {
00838                 strcpy(shortname, longname);
00839                 return 1;
00840         }
00841 
00842         pwd = wb_aix_getpwnam(longname);
00843         if (!pwd) {
00844                 errno = ENOENT;
00845                 return 0;
00846         }
00847 
00848         sprintf(shortname, "%c%07u", WB_AIX_ENCODED, pwd->pw_uid);
00849 
00850         free_pwd(pwd);
00851 
00852         return 1;
00853 }

static int wb_aix_authenticate ( char *  user,
char *  pass,
int *  reenter,
char **  message 
) [static]

winbind_nss_aix.c859 行で定義されています。

参照先 winbindd_request::authwinbindd_request::datadecode_user()errnofree_response()logit()NSS_STATUS_SUCCESSresultWINBINDD_PAM_AUTHwinbindd_request_response().

参照元 wb_aix_init().

00861 {
00862         struct winbindd_request request;
00863         struct winbindd_response response;
00864         NSS_STATUS result;
00865         char *r_user = user;
00866 
00867         logit("authenticate '%s' response='%s'\n", user, pass);
00868 
00869         *reenter = 0;
00870         *message = NULL;
00871 
00872         /* Send off request */
00873         ZERO_STRUCT(request);
00874         ZERO_STRUCT(response);
00875 
00876         if (*user == WB_AIX_ENCODED) {
00877                 r_user = decode_user(r_user);
00878                 if (!r_user) {
00879                         return AUTH_NOTFOUND;
00880                 }
00881         }
00882 
00883         STRCPY_RET(request.data.auth.user, r_user);
00884         STRCPY_RET(request.data.auth.pass, pass);
00885 
00886         if (*user == WB_AIX_ENCODED) {
00887                 free(r_user);
00888         }
00889 
00890         result = winbindd_request_response(WINBINDD_PAM_AUTH, &request, &response);
00891 
00892         free_response(&response);
00893 
00894         logit("auth result %d for '%s'\n", result, user);
00895 
00896         if (result == NSS_STATUS_SUCCESS) {
00897                 errno = 0;
00898                 return AUTH_SUCCESS;
00899         }
00900 
00901         return AUTH_FAILURE;
00902 }

static int wb_aix_chpass ( char *  user,
char *  oldpass,
char *  newpass,
char **  message 
) [static]

winbind_nss_aix.c908 行で定義されています。

参照先 winbindd_request::chauthtokwinbindd_request::datadecode_user()errnofree_response()logit()NSS_STATUS_SUCCESSresultWINBINDD_PAM_CHAUTHTOKwinbindd_request_response().

参照元 wb_aix_init().

00909 {
00910         struct winbindd_request request;
00911         struct winbindd_response response;
00912         NSS_STATUS result;
00913         char *r_user = user;
00914 
00915         if (*user == WB_AIX_ENCODED) {
00916                 r_user = decode_user(r_user);
00917                 if (!r_user) {
00918                         errno = ENOENT;
00919                         return -1;
00920                 }
00921         }
00922 
00923         logit("chpass '%s' old='%s' new='%s'\n", r_user, oldpass, newpass);
00924 
00925         *message = NULL;
00926 
00927         /* Send off request */
00928         ZERO_STRUCT(request);
00929         ZERO_STRUCT(response);
00930 
00931         STRCPY_RET(request.data.chauthtok.user, r_user);
00932         STRCPY_RET(request.data.chauthtok.oldpass, oldpass);
00933         STRCPY_RET(request.data.chauthtok.newpass, newpass);
00934 
00935         if (*user == WB_AIX_ENCODED) {
00936                 free(r_user);
00937         }
00938 
00939         result = winbindd_request_response(WINBINDD_PAM_CHAUTHTOK, &request, &response);
00940 
00941         free_response(&response);
00942 
00943         if (result == NSS_STATUS_SUCCESS) {
00944                 errno = 0;
00945                 return 0;
00946         }
00947 
00948         errno = EINVAL;
00949         return -1;
00950 }

static int wb_aix_passwdrestrictions ( char *  user,
char *  newpass,
char *  oldpass,
char **  message 
) [static]

winbind_nss_aix.c955 行で定義されています。

参照先 logit().

参照元 wb_aix_init().

00957 {
00958         logit("passwdresrictions called for '%s'\n", user);
00959         return 0;
00960 }

static int wb_aix_passwdexpired ( char *  user,
char **  message 
) [static]

winbind_nss_aix.c963 行で定義されています。

参照先 logit().

参照元 wb_aix_init().

00964 {
00965         logit("passwdexpired '%s'\n", user);
00966         /* we should check the account bits here */
00967         return 0;
00968 }

static char* wb_aix_getpasswd ( char *  user  )  [static]

winbind_nss_aix.c974 行で定義されています。

参照先 errnologit().

参照元 wb_aix_init().

00975 {
00976         logit("getpasswd '%s'\n", user);
00977         errno = ENOSYS;
00978         return NULL;
00979 }

static int wb_aix_putentry ( char *  key,
char *  table,
char *  attributes[],
attrval_t  values[],
int  size 
) [static]

winbind_nss_aix.c985 行で定義されています。

参照先 errnologit().

参照元 wb_aix_init().

00987 {
00988         logit("putentry key='%s' table='%s' attrib='%s'\n", 
00989               key, table, size>=1?attributes[0]:"<null>");
00990         errno = ENOSYS;
00991         return -1;
00992 }

static int wb_aix_commit ( char *  key,
char *  table 
) [static]

winbind_nss_aix.c994 行で定義されています。

参照先 errnologit().

参照元 wb_aix_init().

00995 {
00996         logit("commit key='%s' table='%s'\n");
00997         errno = ENOSYS;
00998         return -1;
00999 }

static int wb_aix_getgrusers ( char *  group,
void *  result,
int  type,
int *  size 
) [static]

winbind_nss_aix.c1001 行で定義されています。

参照先 errnologit().

参照元 wb_aix_init().

01002 {
01003         logit("getgrusers group='%s'\n", group);
01004         errno = ENOSYS;
01005         return -1;
01006 }

DECL_METHOD ( delgroup   ) 

DECL_METHOD ( deluser   ) 

DECL_METHOD ( newgroup   ) 

DECL_METHOD ( newuser   ) 

DECL_METHOD ( putgrent   ) 

DECL_METHOD ( putgrusers   ) 

DECL_METHOD ( putpwent   ) 

DECL_METHOD ( lock   ) 

DECL_METHOD ( unlock   ) 

DECL_METHOD ( getcred   ) 

DECL_METHOD ( setcred   ) 

DECL_METHOD ( deletecred   ) 

int wb_aix_init ( struct secmethod_table *  methods  ) 

winbind_nss_aix.c1032 行で定義されています。

参照先 wb_aix_attrlist()wb_aix_authenticate()wb_aix_chpass()wb_aix_close()wb_aix_commit()wb_aix_getentry()wb_aix_getgracct()wb_aix_getgrgid()wb_aix_getgrnam()wb_aix_getgrset()wb_aix_getgrusers()wb_aix_getpasswd()wb_aix_getpwnam()wb_aix_getpwuid()wb_aix_normalize()wb_aix_open()wb_aix_passwdexpired()wb_aix_passwdrestrictions()wb_aix_putentry().

01033 {
01034         ZERO_STRUCTP(methods);
01035 
01036 #ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION
01037         methods->method_version = SECMETHOD_VERSION_520;
01038 #endif
01039 
01040         methods->method_getgrgid           = wb_aix_getgrgid;
01041         methods->method_getgrnam           = wb_aix_getgrnam;
01042         methods->method_getgrset           = wb_aix_getgrset;
01043         methods->method_getpwnam           = wb_aix_getpwnam;
01044         methods->method_getpwuid           = wb_aix_getpwuid;
01045         methods->method_getentry           = wb_aix_getentry;
01046         methods->method_open               = wb_aix_open;
01047         methods->method_close              = wb_aix_close;
01048         methods->method_normalize          = wb_aix_normalize;
01049         methods->method_passwdexpired      = wb_aix_passwdexpired;
01050         methods->method_putentry           = wb_aix_putentry;
01051         methods->method_getpasswd          = wb_aix_getpasswd;
01052         methods->method_authenticate       = wb_aix_authenticate;       
01053         methods->method_commit             = wb_aix_commit;
01054         methods->method_chpass             = wb_aix_chpass;
01055         methods->method_passwdrestrictions = wb_aix_passwdrestrictions;
01056         methods->method_getgracct          = wb_aix_getgracct;
01057         methods->method_getgrusers         = wb_aix_getgrusers;
01058 #ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_ATTRLIST
01059         methods->method_attrlist           = wb_aix_attrlist;
01060 #endif
01061 
01062 #if LOG_UNIMPLEMENTED_CALLS
01063         methods->method_delgroup      = method_delgroup;
01064         methods->method_deluser       = method_deluser;
01065         methods->method_newgroup      = method_newgroup;
01066         methods->method_newuser       = method_newuser;
01067         methods->method_putgrent      = method_putgrent;
01068         methods->method_putgrusers    = method_putgrusers;
01069         methods->method_putpwent      = method_putpwent;
01070         methods->method_lock          = method_lock;
01071         methods->method_unlock        = method_unlock;
01072         methods->method_getcred       = method_getcred;
01073         methods->method_setcred       = method_setcred;
01074         methods->method_deletecred    = method_deletecred;
01075 #endif
01076 
01077         return AUTH_SUCCESS;
01078 }


変数

int debug_enabled [static]

winbind_nss_aix.c58 行で定義されています。

参照元 logit()wb_aix_open().


Sambaに対してSat Aug 29 21:23:55 2009に生成されました。  doxygen 1.4.7