summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-06-02 04:11:50 +0000
committerMatthew Chapman <matty@samba.org>1999-06-02 04:11:50 +0000
commit6aa63bd761241c8b80808651fc570b2d941ee135 (patch)
tree5db1bb343c98fe9b7cd9d43ddf700ed223654988
parent99e42c0656d3e1e3b8e06437a8a9082c12df22d2 (diff)
downloadsamba-6aa63bd761241c8b80808651fc570b2d941ee135.tar.gz
samba-6aa63bd761241c8b80808651fc570b2d941ee135.tar.bz2
samba-6aa63bd761241c8b80808651fc570b2d941ee135.zip
Fixing core dump bug with unix password sync, caused by a NULL
connection_struct in a call to OpenDir. JF, you fixed a similar bug in printing/nt_printing.c, I think your fix is incorrect as global configuration files should not go through a VFS. (This used to be commit 0e0c310a3ea102c61e74b604bcc793a82554a828)
-rw-r--r--source3/smbd/chgpasswd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index c22f268684..734f72c08d 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -60,7 +60,8 @@ static int findpty(char **slave)
int master;
#ifndef HAVE_GRANTPT
static fstring line;
- void *dirp;
+ DIR *dirp;
+ struct dirent *dentry;
char *dpname;
#endif /* !HAVE_GRANTPT */
@@ -82,10 +83,11 @@ static int findpty(char **slave)
#else /* HAVE_GRANTPT */
fstrcpy( line, "/dev/ptyXX" );
- dirp = OpenDir(NULL, "/dev", False);
+ dirp = opendir("/dev");
if (!dirp)
return(-1);
- while ((dpname = ReadDirName(dirp)) != NULL) {
+ while ((dentry = readdir(dirp)) != NULL) {
+ dpname = dentry->d_name;
if (strncmp(dpname, "pty", 3) == 0 && strlen(dpname) == 5) {
DEBUG(3,("pty: try to open %s, line was %s\n", dpname, line ) );
line[8] = dpname[3];
@@ -94,12 +96,12 @@ static int findpty(char **slave)
DEBUG(3,("pty: opened %s\n", line ) );
line[5] = 't';
*slave = line;
- CloseDir(dirp);
+ closedir(dirp);
return (master);
}
}
}
- CloseDir(dirp);
+ closedir(dirp);
#endif /* HAVE_GRANTPT */
return (-1);
}