Lines Matching defs:pwd
27 #include <pwd.h>
241 static int login(AFPObj *obj, struct passwd *pwd, void (*logout)(void), int expired)
248 if ( pwd->pw_uid == 0 ) { /* don't allow root login */
255 afp_versions[afp_version_index].av_name, pwd->pw_name);
273 pwd->pw_name, pwd->pw_uid, addr_net, addr_node, nodename);
279 fprintf(fp, "%s:%d\n", pwd->pw_name, mypid);
281 chown( nodename, pwd->pw_uid, -1 );
287 fprintf(fp, "%s:%d\n", pwd->pw_name, mypid);
289 chown( nodename, pwd->pw_uid, -1 );
296 if (set_groups(obj, pwd) != 0)
310 LOG(log_info, logtype_afpd, "admin login -- %s", pwd->pw_name );
334 sprintf( hostname, "%s@%s", pwd->pw_name, clientname );
336 if( sia_become_user( NULL, argc, argv, hostname, pwd->pw_name,
344 if (setegid( pwd->pw_gid ) < 0 || seteuid( pwd->pw_uid ) < 0) {
345 LOG(log_error, logtype_afpd, "login: %s %s", pwd->pw_name, strerror(errno) );
350 if (setegid( pwd->pw_gid ) < 0 || seteuid( pwd->pw_uid ) < 0) {
351 LOG(log_error, logtype_afpd, "login: %s %s", pwd->pw_name, strerror(errno) );
364 uuid = pwd->pw_uid;
402 int set_groups(AFPObj *obj, struct passwd *pwd)
404 if (initgroups(pwd->pw_name, pwd->pw_gid) < 0)
405 LOG(log_error, logtype_afpd, "initgroups(%s, %d): %s", pwd->pw_name, pwd->pw_gid, strerror(errno));
408 LOG(log_error, logtype_afpd, "login: %s getgroups: %s", pwd->pw_name, strerror(errno));
420 LOG(log_error, logtype_afpd, "login: %s getgroups: %s", pwd->pw_name, strerror(errno));
737 struct passwd *pwd = NULL;
777 i = afp_uam->u.uam_login.login(obj, &pwd, ibuf, ibuflen, rbuf, rbuflen);
779 if (!pwd || ( i != AFP_OK && i != AFPERR_PWDEXPR))
782 return send_reply(obj, login(obj, pwd, afp_uam->u.uam_login.logout, ((i==AFPERR_PWDEXPR)?1:0)));
788 struct passwd *pwd = NULL;
904 i = afp_uam->u.uam_login.login_ext(obj, username, &pwd, ibuf, ibuflen, rbuf, rbuflen);
906 if (!pwd || ( i != AFP_OK && i != AFPERR_PWDEXPR))
909 return send_reply(obj, login(obj, pwd, afp_uam->u.uam_login.logout, ((i==AFPERR_PWDEXPR)?1:0)));
915 struct passwd *pwd = NULL;
924 err = afp_uam->u.uam_login.logincont(obj, &pwd, ibuf, ibuflen,
926 if (!pwd || ( err != AFP_OK && err != AFPERR_PWDEXPR))
929 return send_reply(obj, login(obj, pwd, afp_uam->u.uam_login.logout, ((err==AFPERR_PWDEXPR)?1:0)));
956 struct passwd *pwd;
1001 if (( pwd = uam_getname( obj, username, sizeof(username))) == NULL )
1009 ret = uam->u.uam_changepw(obj, username, pwd, ibuf, ibuflen,