summaryrefslogtreecommitdiff
path: root/source3/smbd/chgpasswd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-07-27 18:50:45 +0000
committerJeremy Allison <jra@samba.org>1998-07-27 18:50:45 +0000
commit1aa138922e5c0e4925ff5cbfcdb4e7cad367b31b (patch)
tree97f6d24aee7bc1b53bb7d3c7d1ad9ce38f88bbee /source3/smbd/chgpasswd.c
parent85474e07804f815a74de399654f28a80722449ab (diff)
downloadsamba-1aa138922e5c0e4925ff5cbfcdb4e7cad367b31b.tar.gz
samba-1aa138922e5c0e4925ff5cbfcdb4e7cad367b31b.tar.bz2
samba-1aa138922e5c0e4925ff5cbfcdb4e7cad367b31b.zip
chgpasswd.c: Fixed up debug calls to stop crashes if ptsname failed.
local.h: Kept FSTYPE_STRING as Samba for now. nmbd_browsesync.c: Added bugfix from Matt Chapman mattyc@cyberdude.com - lmb_browserlist is now a struct ubi_dlList not a struct browse_cache_record *. server.c: smb.h: uid.c: password.c: Removed attrs code - it is not used anywhere. Jeremy (This used to be commit ef1af7fe6d5c58ae57b8e4efff0729e1a315da43)
Diffstat (limited to 'source3/smbd/chgpasswd.c')
-rw-r--r--source3/smbd/chgpasswd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 894762b707..560d989b47 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -74,7 +74,13 @@ static int findpty(char **slave)
grantpt(master);
unlockpt(master);
*slave = ptsname(master);
- return (master);
+ if(*slave == NULL) {
+ DEBUG(0,("findpty: Unable to create master/slave pty pair.\n"));
+ return -1;
+ } else {
+ DEBUG(10, ("findpty: Allocated slave pty %s\n", *slave));
+ return (master);
+ }
}
#else /* USE_GRANTPT */
fstrcpy( line, "/dev/ptyXX" );
@@ -197,6 +203,8 @@ static int dochild(int master,char *slavedev, char *name, char *passwordprogram,
#endif
}
+ DEBUG(10, ("Invoking '%s' as password change program.\n", passwordprogram));
+
/* execl() password-change application */
if (execl("/bin/sh","sh","-c",passwordprogram,NULL) < 0) {
DEBUG(3,("Bad status returned from %s\n",passwordprogram));
@@ -297,7 +305,7 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL
int master;
pid_t pid, wpid;
int wstat;
- BOOL chstat;
+ BOOL chstat = False;
/* allocate a pseudo-terminal device */
if ((master = findpty (&slavedev)) < 0) {
@@ -315,7 +323,6 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL
if ((chstat = talktochild(master, chatsequence)) == False) {
DEBUG(3,("Child failed to change password: %s\n",name));
kill(pid, SIGKILL); /* be sure to end this process */
- return(False);
}
if ((wpid = sys_waitpid(pid, &wstat, 0)) < 0) {
DEBUG(3,("The process is no longer waiting!\n\n"));
@@ -348,7 +355,9 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL
if(as_root)
unbecome_root(False);
}
- DEBUG(3,("Password change %ssuccessful for user %s\n", (chstat?"":"un"), name));
+
+ if(chstat)
+ DEBUG(3,("Password change %ssuccessful for user %s\n", (chstat?"":"un"), name));
return (chstat);
}