Esempio n. 1
0
/*
 * read and hash the passwd file or NIS map
 */
void
plt_init(void)
{
  struct passwd *pent_p;

  if (plt_reset() < 0)		/* could not reset table. skip. */
    return;

  plog(XLOG_INFO, "reading password map");

  hlfsd_setpwent();			/* prepare to read passwd entries */
  while ((pent_p = hlfsd_getpwent()) != (struct passwd *) NULL) {
    table_add(pent_p->pw_uid, pent_p->pw_dir, pent_p->pw_name);
    if (STREQ("root", pent_p->pw_name)) {
      int len;
      if (root_home)
	XFREE(root_home);
      root_home = strdup(pent_p->pw_dir);
      len = strlen(root_home);
      /* remove any trailing '/' chars from root's home (even if just one) */
      while (len > 0 && root_home[len - 1] == '/') {
	len--;
	root_home[len] = '\0';
      }
    }
  }
  hlfsd_endpwent();

  qsort((char *) pwtab, cur_pwtab_num, sizeof(uid2home_t),
	plt_compare_fxn);
  qsort((char *) untab, cur_pwtab_num, sizeof(username2uid_t),
	unt_compare_fxn);

  if (!root_home)
    root_home = strdup("");

  plog(XLOG_INFO, "password map read and sorted");
}
Esempio n. 2
0
/*
 * read and hash the passwd file or NIS map
 */
void
plt_init(void)
{
  struct passwd *pent_p;

  if (plt_reset() < 0)		/* could not reset table. skip. */
    return;

  plog(XLOG_INFO, "reading password map");

  hlfsd_setpwent();			/* prepare to read passwd entries */
  while ((pent_p = hlfsd_getpwent()) != (struct passwd *) NULL) {
    table_add(pent_p->pw_uid, pent_p->pw_dir, pent_p->pw_name);
  }
  hlfsd_endpwent();

  qsort((char *) pwtab, cur_pwtab_num, sizeof(uid2home_t),
	plt_compare_fxn);
  qsort((char *) untab, cur_pwtab_num, sizeof(username2uid_t),
	unt_compare_fxn);

  plog(XLOG_INFO, "password map read and sorted");
}