From 5983a77020a27dd6d7591107070e5167833727d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 5 Jan 2000 23:46:47 +0000 Subject: Moved check_plaintext_password() into smbd/chgpasswd.c from smbd/ipc.c. configure configure.in include/config.h.in: Added autoconf code for Luke's UNIX domain sockets code. Jeremy. (This used to be commit 210d61db08136122f51a93428607fccd582c9e7d) --- source3/configure | 2 +- source3/configure.in | 2 +- source3/include/config.h.in | 3 +++ source3/include/includes.h | 4 ++++ source3/include/proto.h | 2 ++ source3/smbd/chgpasswd.c | 43 +++++++++++++++++++++++++++++++++++++++++++ source3/smbd/ipc.c | 43 ------------------------------------------- 7 files changed, 54 insertions(+), 45 deletions(-) diff --git a/source3/configure b/source3/configure index c1a2a0bf7e..21d6ecfd99 100755 --- a/source3/configure +++ b/source3/configure @@ -1867,7 +1867,7 @@ else fi done -for ac_hdr in sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h +for ac_hdr in sys/param.h ctype.h sys/un.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 diff --git a/source3/configure.in b/source3/configure.in index 5d82418d40..9a45771fbb 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -175,7 +175,7 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h) AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h) AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h) -AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h) +AC_CHECK_HEADERS(sys/param.h ctype.h sys/un.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h) AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h string.h strings.h stdlib.h sys/socket.h) AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h) AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h) diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 2761b1e384..0da717ac42 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -843,6 +843,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H +/* Define if you have the header file. */ +#undef HAVE_SYS_UN_H + /* Define if you have the header file. */ #undef HAVE_SYS_UNISTD_H diff --git a/source3/include/includes.h b/source3/include/includes.h index 7986c12c91..e2139345c0 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -110,6 +110,10 @@ #include #endif +#ifdef HAVE_SYS_UN_H +#include +#endif + #ifdef HAVE_SYS_SYSCALL_H #include #elif HAVE_SYSCALL_H diff --git a/source3/include/proto.h b/source3/include/proto.h index 0222e890d2..dd25ae1d79 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2531,6 +2531,8 @@ BOOL check_oem_password(char *user, struct smb_passwd **psmbpw, char *new_passwd, int new_passwd_size); BOOL change_oem_password(struct smb_passwd *smbpw, char *new_passwd, BOOL override); +BOOL check_plaintext_password(char *user,char *old_passwd, + int old_passwd_size, struct smb_passwd **psmbpw); /*The following definitions come from smbd/close.c */ diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index b86091e773..406f4604b1 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -789,3 +789,46 @@ BOOL change_oem_password(struct smb_passwd *smbpw, char *new_passwd, BOOL overri return ret; } + +/*********************************************************** + Code to check a plaintext password against smbpasswd entries. +***********************************************************/ + +BOOL check_plaintext_password(char *user,char *old_passwd, + int old_passwd_size, struct smb_passwd **psmbpw) +{ + struct smb_passwd *smbpw = NULL; + uchar old_pw[16],old_ntpw[16]; + + become_root(False); + *psmbpw = smbpw = getsmbpwnam(user); + unbecome_root(False); + + if (smbpw == NULL) { + DEBUG(0,("check_plaintext_password: getsmbpwnam returned NULL\n")); + return False; + } + + if (smbpw->acct_ctrl & ACB_DISABLED) { + DEBUG(0,("check_plaintext_password: account %s disabled.\n", user)); + return(False); + } + + nt_lm_owf_gen(old_passwd,old_ntpw,old_pw); + +#ifdef DEBUG_PASSWORD + DEBUG(100,("check_plaintext_password: smbpw->smb_nt_passwd \n")); + dump_data(100,smbpw->smb_nt_passwd,16); + DEBUG(100,("check_plaintext_password: old_ntpw \n")); + dump_data(100,old_ntpw,16); + DEBUG(100,("check_plaintext_password: smbpw->smb_passwd \n")); + dump_data(100,smbpw->smb_passwd,16); + DEBUG(100,("check_plaintext_password: old_pw\n")); + dump_data(100,old_pw,16); +#endif + + if(memcmp(smbpw->smb_nt_passwd,old_ntpw,16) && memcmp(smbpw->smb_passwd,old_pw,16)) + return(False); + else + return(True); +} diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 086a4bfa0b..737b364c6b 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -1660,49 +1660,6 @@ static BOOL api_NetRemoteTOD(connection_struct *conn,uint16 vuid, char *param,ch return(True); } -/*********************************************************** - Code to check a plaintext password against smbpasswd entries. -***********************************************************/ - -static BOOL check_plaintext_password(char *user,char *old_passwd, - int old_passwd_size, struct smb_passwd **psmbpw) -{ - struct smb_passwd *smbpw = NULL; - uchar old_pw[16],old_ntpw[16]; - - become_root(False); - *psmbpw = smbpw = getsmbpwnam(user); - unbecome_root(False); - - if (smbpw == NULL) { - DEBUG(0,("check_plaintext_password: getsmbpwnam returned NULL\n")); - return False; - } - - if (smbpw->acct_ctrl & ACB_DISABLED) { - DEBUG(0,("check_plaintext_password: account %s disabled.\n", user)); - return(False); - } - - nt_lm_owf_gen(old_passwd,old_ntpw,old_pw); - -#ifdef DEBUG_PASSWORD - DEBUG(100,("check_plaintext_password: smbpw->smb_nt_passwd \n")); - dump_data(100,smbpw->smb_nt_passwd,16); - DEBUG(100,("check_plaintext_password: old_ntpw \n")); - dump_data(100,old_ntpw,16); - DEBUG(100,("check_plaintext_password: smbpw->smb_passwd \n")); - dump_data(100,smbpw->smb_passwd,16); - DEBUG(100,("check_plaintext_password: old_pw\n")); - dump_data(100,old_pw,16); -#endif - - if(memcmp(smbpw->smb_nt_passwd,old_ntpw,16) && memcmp(smbpw->smb_passwd,old_pw,16)) - return(False); - else - return(True); -} - /**************************************************************************** Set the user password. *****************************************************************************/ -- cgit