Home
last modified time | relevance | path

Searched refs:pw (Results 1 – 22 of 22) sorted by relevance

/busybox-1.35.0/loginutils/
Dadduser.c187 struct passwd pw; in adduser_main() local
199 pw.pw_gecos = (char *)"Linux User,,,"; in adduser_main()
201 pw.pw_shell = xstrdup(get_shell_name()); /* might come from getpwnam(), need to make a copy */ in adduser_main()
202 pw.pw_dir = NULL; in adduser_main()
210 &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, in adduser_main()
214 pw.pw_uid = xatou_range(uid, 0, CONFIG_LAST_ID); in adduser_main()
217 pw.pw_name = argv[0]; in adduser_main()
223 return addgroup_wrapper(&pw, argv[1]); in adduser_main()
227 die_if_bad_username(pw.pw_name); in adduser_main()
228 if (!pw.pw_dir) { in adduser_main()
[all …]
Dsu.c80 struct passwd *pw; in su_main() local
123 pw = getpwuid(cur_uid); in su_main()
124 old_user = pw ? xstrdup(pw->pw_name) : ""; in su_main()
129 pw = xgetpwnam(opt_username); in su_main()
133 r = ask_and_check_password(pw); in su_main()
163 if (opt_shell && cur_uid != 0 && pw->pw_shell && restricted_shell(pw->pw_shell)) { in su_main()
175 opt_shell = pw->pw_shell; in su_main()
177 change_identity(pw); in su_main()
182 pw); in su_main()
Dpasswd.c43 static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo) in new_password() argument
51 if (myuid != 0 && pw->pw_passwd[0]) { in new_password()
57 encrypted = pw_encrypt(orig, pw->pw_passwd, 1); /* returns malloced str */ in new_password()
58 if (strcmp(encrypted, pw->pw_passwd) != 0) { in new_password()
59 syslog(LOG_WARNING, "incorrect password for %s", pw->pw_name); in new_password()
71 && obscure(orig, newp, pw) /* NB: passing NULL orig is ok */ in new_password()
120 struct passwd *pw; in passwd_main() local
145 pw = xgetpwnam(name); in passwd_main()
146 if (myuid != 0 && pw->pw_uid != myuid) { in passwd_main()
157 if (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result) != 0 in passwd_main()
[all …]
Ddeluser.c96 struct passwd *pw; in deluser_main() local
98 pw = xgetpwnam(name); /* bail out if USER is wrong */ in deluser_main()
107 if (stat(pw->pw_dir, &st) == 0 && S_ISDIR(st.st_mode)) in deluser_main()
108 remove_file(pw->pw_dir, FILEUTILS_RECUR); in deluser_main()
123 struct passwd *pw; in deluser_main() local
125 while ((pw = getpwent()) != NULL) { in deluser_main()
126 if (pw->pw_gid == gr->gr_gid) in deluser_main()
128 pw->pw_name, name); in deluser_main()
Dlogin.c208 static void run_login_script(struct passwd *pw, char *full_tty) in run_login_script() argument
216 xsetenv("LOGIN_USER", pw->pw_name); in run_login_script()
217 xsetenv("LOGIN_UID", utoa(pw->pw_uid)); in run_login_script()
218 xsetenv("LOGIN_GID", utoa(pw->pw_gid)); in run_login_script()
219 xsetenv("LOGIN_SHELL", pw->pw_shell); in run_login_script()
229 void run_login_script(struct passwd *pw, char *full_tty);
331 struct passwd *pw; in login_main() local
466 pw = NULL; in login_main()
467 getpwnam_r(username, &pwdstruct, pwdbuf, sizeof(pwdbuf), &pw); in login_main()
468 if (!pw) in login_main()
[all …]
Dvlock.c66 struct passwd *pw; in vlock_main() local
68 pw = xgetpwuid(getuid()); in vlock_main()
118 pw->pw_name in vlock_main()
120 if (ask_and_check_password(pw) > 0) { in vlock_main()
/busybox-1.35.0/libbb/
Dcorrect_password.c39 #define get_passwd(pw, buffer) get_passwd(pw) argument
41 static const char *get_passwd(const struct passwd *pw, char buffer[SHADOW_BUFSIZE]) in get_passwd() argument
45 if (!pw) in get_passwd()
48 pass = pw->pw_passwd; in get_passwd()
57 r = getspnam_r(pw->pw_name, &spw, buffer, SHADOW_BUFSIZE, &result); in get_passwd()
70 int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext) in check_password() argument
77 pw_pass = get_passwd(pw, buffer); in check_password()
97 int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, in ask_and_check_password_extended() argument
105 pw_pass = get_passwd(pw, buffer); in ask_and_check_password_extended()
115 r = check_password(pw, plaintext); in ask_and_check_password_extended()
[all …]
Dget_shell_name.c13 struct passwd *pw; in get_shell_name() local
20 pw = getpwuid(getuid()); in get_shell_name()
21 if (pw && pw->pw_shell && pw->pw_shell[0]) in get_shell_name()
22 return pw->pw_shell; in get_shell_name()
Dsetup_environment.c32 void FAST_FUNC setup_environment(const char *shell, int flags, const struct passwd *pw) in setup_environment() argument
40 if (chdir(pw->pw_dir) != 0) { in setup_environment()
41 bb_error_msg("can't change directory to '%s'", pw->pw_dir); in setup_environment()
55 xsetenv("PATH", (pw->pw_uid ? bb_default_path : bb_default_root_path)); in setup_environment()
65 if (pw->pw_uid) { in setup_environment()
67 xsetenv("USER", pw->pw_name); in setup_environment()
68 xsetenv("LOGNAME", pw->pw_name); in setup_environment()
70 xsetenv("HOME", pw->pw_dir); in setup_environment()
Dchange_identity.c33 void FAST_FUNC change_identity(const struct passwd *pw) in change_identity() argument
37 res = initgroups(pw->pw_name, pw->pw_gid); in change_identity()
50 if (errno == ENOSYS && pw->pw_uid == getuid()) { in change_identity()
57 xsetgid(pw->pw_gid); in change_identity()
58 xsetuid(pw->pw_uid); in change_identity()
Dobscure.c94 static const char *obscure_msg(const char *old_p, const char *new_p, const struct passwd *pw) in obscure_msg() argument
109 if (string_checker(new_p, pw->pw_name)) { in obscure_msg()
114 if (pw->pw_gecos[0] && string_checker(new_p, pw->pw_gecos)) { in obscure_msg()
174 int FAST_FUNC obscure(const char *old, const char *newval, const struct passwd *pw) in obscure() argument
178 msg = obscure_msg(old, newval, pw); in obscure()
190 static const struct passwd pw = { variable
198 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "", &pw)); in BBUNIT_DEFINE_TEST()
200 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "23577315", &pw)); in BBUNIT_DEFINE_TEST()
202 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "johndoe123%", &pw)); in BBUNIT_DEFINE_TEST()
204 BBUNIT_ASSERT_NOTNULL(obscure_msg("Ad4#21?'S|", "eoD nhoJ^44@", &pw)); in BBUNIT_DEFINE_TEST()
[all …]
Dbb_pwd.c19 struct passwd *pw = getpwnam(name); in xgetpwnam() local
20 if (!pw) in xgetpwnam()
22 return pw; in xgetpwnam()
36 struct passwd *pw = getpwuid(uid); in xgetpwuid() local
37 if (!pw) in xgetpwuid()
39 return pw; in xgetpwuid()
53 struct passwd *pw = xgetpwuid(uid); in xuid2uname() local
54 return pw->pw_name; in xuid2uname()
65 struct passwd *pw = getpwuid(uid); in uid2uname() local
66 return (pw) ? pw->pw_name : NULL; in uid2uname()
Dpw_encrypt_md5.c76 md5_crypt(char result[MD5_OUT_BUFSIZE], const unsigned char *pw, const unsigned char *salt) in md5_crypt() argument
94 pw_len = strlen((char*)pw); in md5_crypt()
95 md5_hash(&ctx, pw, pw_len); in md5_crypt()
108 md5_hash(&ctx1, pw, pw_len); in md5_crypt()
110 md5_hash(&ctx1, pw, pw_len); in md5_crypt()
118 md5_hash(&ctx, ((i & 1) ? final : (const unsigned char *) pw), 1); in md5_crypt()
129 md5_hash(&ctx1, pw, pw_len); in md5_crypt()
137 md5_hash(&ctx1, pw, pw_len); in md5_crypt()
142 md5_hash(&ctx1, pw, pw_len); in md5_crypt()
Dlineedit.c752 struct passwd *pw; in complete_username() local
759 while ((pw = getpwent()) != NULL) { in complete_username()
761 if (/* !ud[0] || */ is_prefixed_with(pw->pw_name, ud)) { in complete_username()
762 add_match(xasprintf("~%s/", pw->pw_name)); in complete_username()
/busybox-1.35.0/util-linux/
Dipcs.c105 struct passwd *pw; in print_perms() local
110 pw = getpwuid(ipcp->cuid); in print_perms()
111 if (pw) printf(" %-10s", pw->pw_name); in print_perms()
117 pw = getpwuid(ipcp->uid); in print_perms()
118 if (pw) printf(" %-10s", pw->pw_name); in print_perms()
132 struct passwd *pw; in do_shm() local
205 pw = getpwuid(ipcp->uid); in do_shm()
208 if (pw) in do_shm()
209 printf("%-10d %-10.10s", shmid, pw->pw_name); in do_shm()
221 if (pw) in do_shm()
[all …]
/busybox-1.35.0/debianutils/
Dstart_stop_daemon.c553 struct passwd *pw = xgetpwuid(ugid.uid); in start_stop_daemon_main() local
555 pw->pw_gid = ugid.gid; in start_stop_daemon_main()
557 change_identity(pw); in start_stop_daemon_main()
/busybox-1.35.0/networking/
Dftpd.c1176 struct passwd *pw = NULL; in ftpd_main() local
1270 pw = getpwnam(anon_opt); in ftpd_main()
1271 if (pw) in ftpd_main()
1274 pw = getpwnam(G.ftp_arg); in ftpd_main()
1277 if (check_password(pw, G.ftp_arg) > 0) { in ftpd_main()
1281 pw = NULL; in ftpd_main()
1322 if (pw) in ftpd_main()
1323 change_identity(pw); in ftpd_main()
Dtftp.c192 struct passwd *pw; member
351 if (G.pw) {
352 change_identity(G.pw); /* initgroups, setgid, setuid */
916 G.pw = xgetpwnam(user_opt); in tftpd_main()
Dhttpd.c1960 const char *pw; member
1987 s = userinfo->pw; in pam_talker()
2079 userinfo.pw = colon_after_user + 1; in check_user_passwd()
2094 struct passwd *pw; in check_user_passwd()
2097 pw = getpwnam(user_and_passwd); in check_user_passwd()
2099 if (!pw || !pw->pw_passwd) in check_user_passwd()
2101 passwd = pw->pw_passwd; in check_user_passwd()
2107 r = getspnam_r(pw->pw_name, &spw, sp_buf, sizeof(sp_buf), &result); in check_user_passwd()
/busybox-1.35.0/archival/
Drpm.c246 struct passwd *pw = getpwnam(rpm_getstr(TAG_FILEUSERNAME, fileref)); in fileaction_setowngrp() local
247 int uid = pw ? pw->pw_uid : getuid(); /* or euid? */ in fileaction_setowngrp()
/busybox-1.35.0/include/
Dlibbb.h1687 void change_identity(const struct passwd *pw) FAST_FUNC;
1747 void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC;
1755 int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC;
1756 int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_…
1757 int ask_and_check_password(const struct passwd *pw) FAST_FUNC;
/busybox-1.35.0/shell/
Dash.c6504 struct passwd *pw; in exptilde() local
6533 pw = getpwnam(name); in exptilde()
6534 if (pw == NULL) in exptilde()
6536 home = pw->pw_dir; in exptilde()