From 05eb22f77c21f8027e64b0caddefa4d9f030f95f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 11 May 1998 17:53:37 +0000 Subject: reply.c: Added code to not overwrite sesssetup_user when in share level security and null session setup done. smbpasswd.c: Fix from Gerald Carter to fix incorrect use of pointer. Jeremy. (This used to be commit 69ace0760986a6e892cd5b25ca85930b65e38c45) --- source3/smbd/reply.c | 9 ++++++++- source3/utils/smbpasswd.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index b8270495fd..c927e09425 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -586,7 +586,14 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize) strlower(user); - strcpy(sesssetup_user,user); + /* + * In share level security, only overwrite sesssetup_use if + * it's a non null-session share. Helps keep %U and %G + * working. + */ + + if((lp_security() != SEC_SHARE) || *user) + strcpy(sesssetup_user,user); reload_services(True); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index d58d6396c1..5060d80d3d 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -646,7 +646,7 @@ int main(int argc, char **argv) vp = startsampwent(True); } } - if (!fp) { + if (!vp) { err = errno; fprintf(stderr, "%s: Failed to open password file %s.\n", prog_name, lp_smb_passwd_file()); -- cgit