search for: pw_dir

Displaying 20 results from an estimated 113 matches for "pw_dir".

2002 Nov 05
2
[PATCH] Add a chroot_users option to sshd
...39;); + if (snapshot == NULL) + snapshot = xmalloc(128); + strncpy(snapshot, command+strlen(SNAPSHOT), idx - (command + strlen(SNAPSHOT))); + } + if (snapshot != NULL && snapshot[0] != '\0') { + char home[MAXPATHLEN]; + char *current; + current = strstr(pw->pw_dir, "current"); + if (current != NULL) { + strncpy(home, pw->pw_dir, current - pw->pw_dir); + home[current-pw->pw_dir] = '\0'; + strcat(home, snapshot); + strcat(home, current + strlen("current") ); + } + else + strcpy(home, pw->pw_d...
2016 Apr 19
2
llvm::sys::path::home_directory() implementation for unix
..._directory(SmallVectorImpl<char> &result) { if (char *RequestedDir = getenv("HOME")) { result.clear(); result.append(RequestedDir, RequestedDir + strlen(RequestedDir)); return true; } else { struct passwd *pw = getpwuid(getuid()); if (pw && pw->pw_dir && pw->pw_dir[0]) { setenv("HOME", pw->pw_dir, 0); result.assign(llvm::StringRef(pw->pw_dir)); return true; } } return false; }
2004 Dec 01
1
$HOME instead of pw->pw_dir question.
Hello. I have one, small question. There are any security reasons to not use a getenv("HOME") instead of pw->pw_dir in ssh.c and tildexpand.c to find user home directory? -- Grzegorz Kryza mailto: kryza at nomachine.com http://grzegorz.kryza.net
2002 Jan 27
0
IdentityFile patch
...er_init(&buffer); - for (cp = filename; *cp; cp++) { - if (cp[0] == '%' && cp[1] == '%') { - buffer_append(&buffer, "%", 1); - cp++; - continue; - } - if (cp[0] == '%' && cp[1] == 'h') { - buffer_append(&buffer, pw->pw_dir, strlen(pw->pw_dir)); - cp++; - continue; - } - if (cp[0] == '%' && cp[1] == 'u') { - buffer_append(&buffer, pw->pw_name, - strlen(pw->pw_name)); - cp++; - continue; - } - buffer_append(&buffer, cp, 1); - } - buffer_append(&buffer, &...
2003 Jan 18
0
[Patch] User-dependent IdentityFile
...er_init(&buffer); - for (cp = filename; *cp; cp++) { - if (cp[0] == '%' && cp[1] == '%') { - buffer_append(&buffer, "%", 1); - cp++; - continue; - } - if (cp[0] == '%' && cp[1] == 'h') { - buffer_append(&buffer, pw->pw_dir, strlen(pw->pw_dir)); - cp++; - continue; - } - if (cp[0] == '%' && cp[1] == 'u') { - buffer_append(&buffer, pw->pw_name, - strlen(pw->pw_name)); - cp++; - continue; - } - buffer_append(&buffer, cp, 1); - } - buffer_append(&buffer, &q...
2004 Feb 27
1
[PATCH] Getting AFS tokens from a GSSAPI-delegated TGT
...et_afs_token && k_hasafs()) { + session_krb5_use_ccache(s->authctxt); + if (s->authctxt->krb5_ctx != NULL) { + char cell[64]; - debug("Getting AFS token"); + debug("Getting AFS token"); - k_setpag(); + k_setpag(); - if (k_afs_cell_of_file(pw->pw_dir, cell, sizeof(cell)) == 0) - krb5_afslog(s->authctxt->krb5_ctx, - s->authctxt->krb5_fwd_ccache, cell, NULL); + if (k_afs_cell_of_file(pw->pw_dir, cell, sizeof(cell)) == 0) + krb5_afslog(s->authctxt->krb5_ctx, + s->authctxt->krb5_fwd_ccache, cell, NULL)...
2001 Mar 14
1
[PATCH]: contrib/cygwin/README
Hi, I have a small patch here which changes the Cygwin README file so that the following fact is mentioned. OpenSSH never uses $HOME to search for user config files but the value in the pw_dir field in /etc/passwd. This might be of minor interest for generic U*X folks but that's an important fact for Cygwin users. When /etc/passwd is automatically created under WinNT/2K it uses the values in the NT user datebase to determine the home directory of the user. Actually, it's an comp...
2002 Jan 27
1
[PATCH] Add user-dependent IdentityFile to OpenSSH-3.0.2p1
...er_init(&buffer); - for (cp = filename; *cp; cp++) { - if (cp[0] == '%' && cp[1] == '%') { - buffer_append(&buffer, "%", 1); - cp++; - continue; - } - if (cp[0] == '%' && cp[1] == 'h') { - buffer_append(&buffer, pw->pw_dir, strlen(pw->pw_dir)); - cp++; - continue; - } - if (cp[0] == '%' && cp[1] == 'u') { - buffer_append(&buffer, pw->pw_name, - strlen(pw->pw_name)); - cp++; - continue; - } - buffer_append(&buffer, cp, 1); - } - buffer_append(&buffer, &...
2008 Oct 21
1
Create user home directory or user-own folder on samba server on first login to samba
Hello, I'd like to create user home directory or user-own folder on samba server on first login to samba without using PAM, so how could I do this? Thank you, Denis
2000 Oct 24
2
feature request & patch submit: chroot(2) in sshd
...oot/session.c Sun Oct 22 20:20:57 2000 @@ -947,6 +947,20 @@ } } #endif /* USE_PAM */ + + /* Do a chroot, if configured. */ + if (options.use_chroot) { + if ((!options.chroot_group) + || (options.chroot_group == pw->pw_gid)) { + debug("Doing chroot to %s.",pw->pw_dir); + if (chroot(pw->pw_dir)) { + log("Requested chroot failed: [%d] %s\n", + errno,strerror(errno)); + exit(1); + } + pw->pw_dir = "/"; + } + } /* Set login name, uid, gid, and groups. */ /* Login(1) does this as well, and i...
2018 Oct 04
2
vpopmail
...ur passwords in vpopmail with {SCHEME} (like,? {CRYPT}) >>> Aki >> >> >> Or use SQL -? then you don't have to munge any of your tools. >> >> password_query = >> SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS >> password, pw_dir as userdb_home, 89 as userdb_uid, 89 as userdb_gid >> FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' AND >> !(pw_gid & 8) AND !(pw_gid & 2) AND ('%r'!='<webserverip>' or >> !(pw_gid & 4)) >> >> pw_gid refer...
2001 Jul 29
1
add version 2 identities by default, too
...as no identities.\n"); } +void +add_default_identities(AuthenticationConnection *ac, int deleting) +{ + char identity_name[1024]; + char dsa_name[1024]; + char rsa_name[1024]; + struct passwd *pw = getpwuid(getuid()); + snprintf(identity_name, sizeof identity_name, "%s/%s", pw->pw_dir, _PATH_SSH_CLIENT_IDENTITY); + snprintf(rsa_name, sizeof rsa_name, "%s/%s", pw->pw_dir, _PATH_SSH_CLIENT_ID_RSA); + snprintf(dsa_name, sizeof dsa_name, "%s/%s", pw->pw_dir, _PATH_SSH_CLIENT_ID_DSA); + if (!pw) { + fprintf(stderr, "No user found with uid %u\n", +...
2001 Oct 03
0
a trouble about filename authentication in 2.9.9p2
...ading OpenSSH to 2.9.9p2, I've found some troubles on public key authentication with an sshd working at Solaris 2.5.1 machine. The server failed to validate the user's path in auth.c:secure_filename(). There were actually two reasons for the trouble: 1. the "realpath" of pw->pw_dir (that realpath() would return) was different from pw->pw_dir itself. Thus, comparing the directory name to each directory in the for loop of the function never succeeded. 2. Our Solaris box had its own dirname(), which returned an empty string for the root directory. So the stat()...
2003 Aug 16
0
sftp-server (secure) chroot patch, comment fix
...NULL) + fatal("getpwuid failed for %u", (u_int)pw->pw_uid ); + + /* Sets passwd pointer to null */ + memset(pw->pw_passwd, 0, strlen(pw->pw_passwd)); + endpwent(); + + if (geteuid() != 0) + fatal("must be SUID root to use chroot feature"); + + if ((stat(pw->pw_dir, &st)) == -1) + fatal("cannot stat chroot directory %s: %s", pw->pw_dir, strerror(errno)); + + if (!S_ISDIR(st.st_mode)) + fatal("%s is not a directory: %s", pw->pw_dir, strerror(errno)); + + /* Drop our privileges */ + debug3("chroot user:group %u:%u", (u_...
2003 Sep 30
1
[PATCH] sftp-server (secure) chroot patch, 3.7.1p2 update
...L) + fatal(\"getpwuid failed for %u\", (u_int)pw->pw_uid ); + + /* Sets passwd pointer to null */ + memset(pw->pw_passwd, 0, strlen(pw->pw_passwd)); + endpwent(); + + if (geteuid() != 0) + fatal(\"must be SUID root to use chroot feature\"); + + if ((stat(pw->pw_dir, &st)) == -1) + fatal(\"cannot stat chroot directory %s: %s\", pw->pw_dir, strerror(errno)); + + if (!S_ISDIR(st.st_mode)) + fatal(\"%s is not a directory: %s\", pw->pw_dir, strerror(errno)); + + /* Drop our privileges */ + debug3(\"chroot user:group %u:%u\&quot...
2008 Apr 28
7
[Bug 1461] New: session.c: don't chdir() after chroot() if chroot_path==pw->pw_dir
https://bugzilla.mindrot.org/show_bug.cgi?id=1461 Summary: session.c: don't chdir() after chroot() if chroot_path==pw->pw_dir Classification: Unclassified Product: Portable OpenSSH Version: 5.0p1 Platform: ix86...
2000 Oct 07
0
OpenSSH changes for BSD/OS
...*p; + bsduser = xstrdup(user); + if ((p = strchr(user, ':')) != NULL) + *p = '\0'; + } + #endif pw = getpwnam(user); if (!pw || !allowed_user(pw)) do_fake_authloop1(user); *************** *** 482,487 **** --- 500,508 ---- pwcopy.pw_gid = pw->pw_gid; pwcopy.pw_dir = xstrdup(pw->pw_dir); pwcopy.pw_shell = xstrdup(pw->pw_shell); + #if defined(BSD) && BSD >= 199506 + pwcopy.pw_class = xstrdup(pw->pw_class); + #endif pw = &pwcopy; #ifdef USE_PAM *************** *** 508,514 **** (sia_validate_user(NULL, saved_argc, saved...
2018 Oct 04
3
vpopmail
...cate against the hash instead of the clear text? > > Prefix your passwords in vpopmail with {SCHEME} (like,? {CRYPT}) > Aki Or use SQL -? then you don't have to munge any of your tools. password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, pw_dir as userdb_home, 89 as userdb_uid, 89 as userdb_gid FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' AND !(pw_gid & 8) AND !(pw_gid & 2) AND ('%r'!='<webserverip>' or !(pw_gid & 4)) pw_gid refers to the the binary vpopmail flags for disable...
2001 Jan 03
1
chroot.diff
...#endif /* CHROOT */ #ifdef WITH_IRIX_PROJECT prid_t projid; #endif /* WITH_IRIX_PROJECT */ @@ -1076,6 +1082,26 @@ # else /* HAVE_LOGIN_CAP */ if (setlogin(pw->pw_name) < 0) error("setlogin failed: %s", strerror(errno)); +# ifdef CHROOT + user_dir = xstrdup(pw->pw_dir); + new_root = user_dir + 1; + + while((new_root = strchr(new_root, '.')) != NULL) { + new_root--; + if(strncmp(new_root, "/./", 3) == 0) { + *new_root = '\0...
2003 Aug 16
0
sftp-server (secure) chroot patch?
...for %u", (u_int)pw->pw_uid ); + + /* Sets passwd pointer to null */ + memset(pw->pw_passwd, 0, strlen(pw->pw_passwd)); + endpwent(); + + if (geteuid() != 0) + fatal("must be SUID root to use chroot feature"); + + if ((stat(pw->pw_dir, &st)) == -1) + fatal("cannot stat chroot directory %s: %s", pw->pw_dir, strerror(errno)); + + if (!S_ISDIR(st.st_mode)) + fatal("%s is not a directory: %s", pw->pw_dir, strerror(errno)); + + /* Drop our privileges */ + deb...