Lines Matching refs:cnf
74 static uid_t pw_uidpolicy(struct userconf *cnf, intmax_t id);
75 static uid_t pw_gidpolicy(struct userconf *cnf, char *grname, char *nam,
77 static char *pw_homepolicy(struct userconf * cnf, char *homedir,
79 static char *pw_shellpolicy(struct userconf * cnf);
80 static char *pw_password(struct userconf * cnf, char const * user);
133 create_and_populate_homedir(struct userconf *cnf, struct passwd *pwd, in create_and_populate_homedir() argument
149 pw_log(cnf, update ? M_MODIFY : M_ADD, W_USER, "%s(%ju) home %s made", in create_and_populate_homedir()
307 pw_uidpolicy(struct userconf * cnf, intmax_t id) in pw_uidpolicy() argument
329 if (cnf->min_uid >= cnf->max_uid) { /* Sanity in pw_uidpolicy()
331 cnf->min_uid = 1000; in pw_uidpolicy()
332 cnf->max_uid = 32000; in pw_uidpolicy()
334 bm = bm_alloc(cnf->max_uid - cnf->min_uid + 1); in pw_uidpolicy()
341 if (pwd->pw_uid >= (uid_t) cnf->min_uid && pwd->pw_uid <= (uid_t) cnf->max_uid) in pw_uidpolicy()
342 bm_setbit(&bm, pwd->pw_uid - cnf->min_uid); in pw_uidpolicy()
348 if (cnf->reuse_uids || (uid = (uid_t) (bm_lastset(&bm) + cnf->min_uid + 1)) > cnf->max_uid) in pw_uidpolicy()
349 uid = (uid_t) (bm_firstunset(&bm) + cnf->min_uid); in pw_uidpolicy()
354 if (uid < cnf->min_uid || uid > cnf->max_uid) in pw_uidpolicy()
361 pw_gidpolicy(struct userconf *cnf, char *grname, char *nam, gid_t prefer, bool dryrun) in pw_gidpolicy() argument
393 gid = pw_groupnext(cnf, true); in pw_gidpolicy()
396 grid = pw_groupnext(cnf, true); in pw_gidpolicy()
397 groupadd(cnf, nam, grid, NULL, -1, false, false, false); in pw_gidpolicy()
407 pw_homepolicy(struct userconf * cnf, char *homedir, const char *user) in pw_homepolicy() argument
414 if (cnf->home == NULL || *cnf->home == '\0') in pw_homepolicy()
416 snprintf(home, sizeof(home), "%s/%s", cnf->home, user); in pw_homepolicy()
457 pw_shellpolicy(struct userconf * cnf) in pw_shellpolicy() argument
460 return shell_path(cnf->shelldir, cnf->shells, cnf->shell_default); in pw_shellpolicy()
492 pw_password(struct userconf * cnf, char const * user) in pw_password() argument
497 switch (cnf->default_password) { in pw_password()
698 struct userconf *cnf = NULL; in pw_user_next() local
724 cnf = get_userconfig(cfg); in pw_user_next()
726 next = pw_uidpolicy(cnf, -1); in pw_user_next()
729 pw_groupnext(cnf, quiet); in pw_user_next()
821 struct userconf *cnf = NULL; in pw_user_del() local
882 cnf = get_userconfig(cfg); in pw_user_del()
885 nispasswd = cnf->nispasswd; in pw_user_del()
986 pw_log(cnf, M_DELETE, W_USER, "%s(%ju) account removed", name, in pw_user_del()
1002 pw_log(cnf, M_DELETE, W_USER, "%s(%ju) home '%s' %s" in pw_user_del()
1092 validate_grname(struct userconf *cnf, char *group) in validate_grname() argument
1097 cnf->default_group = ""; in validate_grname()
1101 cnf->default_group = newstr(grp->gr_name); in validate_grname()
1178 struct userconf *cnf, *cmdcnf; in pw_user_add() local
1333 cnf = get_userconfig(cfg); in pw_user_add()
1335 mix_config(cmdcnf, cnf); in pw_user_add()
1338 cnf->default_password); in pw_user_add()
1385 pwd->pw_gid = pw_gidpolicy(cnf, grname, pwd->pw_name, in pw_user_add()
1456 pw_log(cnf, M_ADD, W_USER, "%s(%ju):%s(%ju):%s:%s:%s", in pw_user_add()
1487 (fp = fopen(cnf->newmail, "r")) != NULL) { in pw_user_add()
1498 pw_log(cnf, M_ADD, W_USER, "%s(%ju) new user mail sent", in pw_user_add()
1505 pw_log(cnf, M_ADD, W_USER, "NIS maps updated"); in pw_user_add()
1513 struct userconf *cnf; in pw_user_mod() local
1650 cnf = get_userconfig(cfg); in pw_user_mod()
1667 nispasswd = cnf->nispasswd; in pw_user_mod()
1722 shell = shell_path(cnf->shelldir, cnf->shells, shell); in pw_user_mod()
1754 cnf->default_password = passwd_val(passwd, in pw_user_mod()
1755 cnf->default_password); in pw_user_mod()
1756 pwd->pw_passwd = pw_password(cnf, pwd->pw_name); in pw_user_mod()
1823 pw_log(cnf, M_MODIFY, W_USER, "%s(%ju):%s(%ju):%s:%s:%s", in pw_user_mod()
1837 skel = cnf->dotdir; in pw_user_mod()
1839 homemode = cnf->homemode; in pw_user_mod()
1840 create_and_populate_homedir(cnf, pwd, skel, homemode, true); in pw_user_mod()
1844 pw_log(cnf, M_MODIFY, W_USER, "NIS maps updated"); in pw_user_mod()