Lines Matching defs:cnf

77 static uid_t	 pw_uidpolicy(struct userconf *cnf, intmax_t id);
78 static uid_t pw_gidpolicy(struct userconf *cnf, char *grname, char *nam,
80 static char *pw_homepolicy(struct userconf * cnf, char *homedir,
82 static char *pw_shellpolicy(struct userconf * cnf);
83 static char *pw_password(struct userconf * cnf, char const * user,
121 * But we create a symlink from cnf->home -> "/usr" -> cnf->home
154 create_and_populate_homedir(struct userconf *cnf, struct passwd *pwd,
170 pw_log(cnf, update ? M_UPDATE : M_ADD, W_USER, "%s(%ju) home %s made",
328 pw_uidpolicy(struct userconf * cnf, intmax_t id)
350 if (cnf->min_uid >= cnf->max_uid) { /* Sanity
352 cnf->min_uid = 1000;
353 cnf->max_uid = 32000;
355 bm = bm_alloc(cnf->max_uid - cnf->min_uid + 1);
362 if (pwd->pw_uid >= (uid_t) cnf->min_uid && pwd->pw_uid <= (uid_t) cnf->max_uid)
363 bm_setbit(&bm, pwd->pw_uid - cnf->min_uid);
369 if (cnf->reuse_uids || (uid = (uid_t) (bm_lastset(&bm) + cnf->min_uid + 1)) > cnf->max_uid)
370 uid = (uid_t) (bm_firstunset(&bm) + cnf->min_uid);
375 if (uid < cnf->min_uid || uid > cnf->max_uid)
382 pw_gidpolicy(struct userconf *cnf, char *grname, char *nam, gid_t prefer, bool dryrun)
415 gid = pw_groupnext(cnf, true);
418 grid = pw_groupnext(cnf, true);
419 groupadd(cnf, nam, grid, NULL, -1, false, false, false);
429 pw_homepolicy(struct userconf * cnf, char *homedir, const char *user)
436 if (cnf->home == NULL || *cnf->home == '\0')
438 snprintf(home, sizeof(home), "%s/%s", cnf->home, user);
479 pw_shellpolicy(struct userconf * cnf)
482 return shell_path(cnf->shelldir, cnf->shells, cnf->shell_default);
514 pw_password(struct userconf * cnf, char const * user, bool dryrun)
519 switch (cnf->default_password) {
743 struct userconf *cnf = NULL;
763 cnf = get_userconfig(cfg);
765 next = pw_uidpolicy(cnf, -1);
768 pw_groupnext(cnf, quiet);
854 struct userconf *cnf = NULL;
909 cnf = get_userconfig(cfg);
912 nispasswd = cnf->nispasswd;
1005 pw_log(cnf, M_DELETE, W_USER, "%s(%ju) account removed", name,
1021 pw_log(cnf, M_DELETE, W_USER, "%s(%ju) home '%s' %s"
1099 validate_grname(struct userconf *cnf, char *group)
1104 cnf->default_group = "";
1108 cnf->default_group = newstr(grp->gr_name);
1185 struct userconf *cnf, *cmdcnf;
1334 cnf = get_userconfig(cfg);
1336 mix_config(cmdcnf, cnf);
1339 cnf->default_password);
1386 pwd->pw_gid = pw_gidpolicy(cnf, grname, pwd->pw_name,
1454 pw_log(cnf, M_ADD, W_USER, "%s(%ju):%s(%ju):%s:%s:%s",
1485 (fp = fopen(cnf->newmail, "r")) != NULL) {
1496 pw_log(cnf, M_ADD, W_USER, "%s(%ju) new user mail sent",
1503 pw_log(cnf, M_ADD, W_USER, "NIS maps updated");
1511 struct userconf *cnf;
1642 cnf = get_userconfig(cfg);
1659 nispasswd = cnf->nispasswd;
1714 shell = shell_path(cnf->shelldir, cnf->shells, shell);
1746 cnf->default_password = passwd_val(passwd,
1747 cnf->default_password);
1748 pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun);
1815 pw_log(cnf, M_UPDATE, W_USER, "%s(%ju):%s(%ju):%s:%s:%s",
1829 skel = cnf->dotdir;
1831 homemode = cnf->homemode;
1832 create_and_populate_homedir(cnf, pwd, skel, homemode, true);
1836 pw_log(cnf, M_UPDATE, W_USER, "NIS maps updated");