patch collection for 2.2.5

Yasuma Takeda yasuma at miraclelinux.com
Tue Jul 16 01:08:02 GMT 2002


Hi,
I added a patch for 2.2.5, which was reported in Samba-JP.

This patch includes following corrections.
 - more appropriate use of cast and const word
 - more appropriate use of macro
 - fixed some problems of multibyte characters
 - fixed prototype definition
 - fixed some typo, etc

This patch does not include following files. Please remake these files. 
 1. configure made by autoconf.
 2. config.h.in made by autoheader.
 3. proto.h, rpc_client_proto.h, winbindd_proto.h made by make proto.


Best Regards,
Yasuma Takeda


-------------- next part --------------
diff -uNr samba-2.2.5.org/source/Makefile.in samba-2.2.5/source/Makefile.in
--- samba-2.2.5.org/source/Makefile.in	Wed Jun 19 10:13:24 2002
+++ samba-2.2.5/source/Makefile.in	Tue Jul 16 13:46:42 2002
@@ -96,12 +96,12 @@
 
 SPROGS = bin/smbd bin/nmbd bin/swat
 PROGS1 = bin/smbclient bin/smbspool bin/testparm bin/testprns bin/smbstatus bin/smbcontrol bin/tdbbackup bin/make_printerdef @RUNPROG@ 
-PROGS2 = bin/smbpasswd bin/make_smbcodepage bin/rpcclient bin/make_unicodemap bin/smbcacls @WRAPPROG@ @WRAP@ @WRAP32@ @PAM_MOD@ @PDBEDIT@ @LIBSMBCLIENT@
+PROGS2 = bin/smbpasswd bin/make_smbcodepage bin/rpcclient bin/make_unicodemap bin/smbcacls @WRAPPROG@ @WRAP@ @WRAP32@ @PAM_MOD@ @PDBEDIT@
 MPROGS = @MPROGS@
 LPROGS = $(WINBIND_PAM_PROGS) $(WINBIND_LPROGS)
 PROGS = $(PROGS1) $(PROGS2) $(MPROGS) bin/nmblookup
 TORTURE_PROGS = bin/smbtorture bin/msgtest bin/masktest bin/locktest bin/locktest2
-SHLIBS = libsmbclient
+SHLIBS = @LIBSMBCLIENT@
 
 SCRIPTS = $(srcdir)/script/smbtar  $(srcdir)/script/findsmb
 
@@ -422,13 +422,13 @@
 all : CHECK $(SPROGS) $(PROGS) $(WINBIND_PROGS) $(WINBIND_SPROGS) $(LPROGS)
 
 # The following "everything" is NOT needed except by Samba developers - so do not use this!
-everything : CHECK $(SPROGS) $(PROGS) $(SHLIBS) nsswitch smbwrapper smbtorture debug2html smbfilter nsswitch/libnss_wins.so
+everything : CHECK $(SPROGS) $(PROGS) $(SHLIBS) nsswitch smbwrapper smbtorture debug2html smbfilter nsswitch/libnss_wins. at SHLIBEXT@
 
 pam_smbpass : CHECK bin/pam_smbpass. at SHLIBEXT@
 
 smbwrapper : CHECK @WRAPPROG@ @WRAP@ @WRAP32@
 
-libsmbclient : CHECK bin/libsmbclient. at SHLIBEXT@ bin/libsmbclient.a
+libsmbclient : CHECK @LIBSMBCLIENT_SHARED@ @LIBSMBCLIENT_NON_SHARED@
 
 torture : CHECK $(TORTURE_PROGS)
 
@@ -631,7 +631,7 @@
 
 bin/smbwrapper. at SHLIBEXT@: $(PICOBJS) bin/.dummy
 	@echo Linking shared library $@
-	@$(SHLD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LIBS) \
+	@$(SHLD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LDFLAGS) $(LIBS) \
 		@SONAMEFLAG@`basename $@`
 
 bin/smbwrapper.32. at SHLIBEXT@: $(PICOBJS32) bin/.dummy
@@ -641,19 +641,19 @@
 
 bin/libsmbclient. at SHLIBEXT@: $(LIBSMBCLIENT_PICOBJS) bin/.dummy
 	@echo Linking libsmbclient shared library $@
-	@$(SHLD) @LDSHFLAGS@ -o $@ $(LIBSMBCLIENT_PICOBJS) $(LIBS) \
+	@$(SHLD) @LDSHFLAGS@ -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \
 		@SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)
 
 bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS) bin/.dummy
 	@echo Linking libsmbclient non-shared library $@
-	@-$(AR) -rc $@ $(LIBSMBCLIENT_PICOBJS)
+	@-$(AR) rc $@ $(LIBSMBCLIENT_PICOBJS)
 
 bin/pam_smbpass. at SHLIBEXT@: $(PAM_SMBPASS_OBJ) bin/.dummy
 	@echo Linking shared library $@
 	$(SHLD) @LDSHFLAGS@ -o $@ $(PAM_SMBPASS_OBJ) $(LDFLAGS) -lpam $(DYNEXP) $(LIBS) -lc \
 		@SONAMEFLAG@`basename $@`
 
-nsswitch/libnss_wins.so: $(NSS_OBJ)
+nsswitch/libnss_wins. at SHLIBEXT@: $(NSS_OBJ)
 	@echo "Linking $@"
 	@$(SHLD) @LDSHFLAGS@ -o $@ $(NSS_OBJ) -lc \
 		@SONAMEFLAG@`basename $@`
@@ -662,17 +662,17 @@
 	@echo Linking $@
 	@$(LINK) -o $@ $(WINBINDD_OBJ) $(DYNEXP) $(LIBS) $(LDAPLIBS)
 
-nsswitch/libns_winbind.so: $(WINBIND_NSS_PICOBJS)
+nsswitch/libns_winbind. at SHLIBEXT@: $(WINBIND_NSS_PICOBJS)
 	@echo "Linking $@"
 	@$(SHLD) @LDSHFLAGS@ -o $@ $(WINBIND_NSS_PICOBJS) @WINBIND_NSS_EXTRA_LIBS@ \
 		@SONAMEFLAG@`basename $@`
 
-nsswitch/libnss_winbind.so: $(WINBIND_NSS_PICOBJS)
+nsswitch/libnss_winbind. at SHLIBEXT@: $(WINBIND_NSS_PICOBJS)
 	@echo "Linking $@"
 	@$(SHLD) @LDSHFLAGS@ -o $@ $(WINBIND_NSS_PICOBJS) @WINBIND_NSS_EXTRA_LIBS@ \
 		@SONAMEFLAG@`basename $@`
 
-nsswitch/pam_winbind.so: $(PAM_WINBIND_OBJ)
+nsswitch/pam_winbind. at SHLIBEXT@: $(PAM_WINBIND_OBJ)
 	@echo Linking $@
 	@$(SHLD) @LDSHFLAGS@ -o $@ $(PAM_WINBIND_OBJ) \
 		@SONAMEFLAG@`basename $@`
@@ -697,6 +697,7 @@
 	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) $(VARDIR)
 	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) $(PIDDIR)
 	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) $(CODEPAGEDIR)
+	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) $(SWATDIR)
 
 installservers: all installdirs
 	@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS)
@@ -714,9 +715,11 @@
 installswat: installdirs
 	@$(SHELL) $(srcdir)/script/installswat.sh $(SWATDIR) $(srcdir)
 
-installclientlib:
-	-$(INSTALLCMD) bin/libsmbclient.so
-	-$(INSTALLCMD) -d ${prefix}/include
+installclientlib: @LIBSMBCLIENT@
+	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) ${prefix}/lib
+	-$(INSTALLCMD) @LIBSMBCLIENT_SHARED@ ${prefix}/lib
+	-$(INSTALLCMD) @LIBSMBCLIENT_NON_SHARED@ ${prefix}/lib
+	$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) ${prefix}/include
 	-$(INSTALLCMD) include/libsmbclient.h ${prefix}/include
 
 # revert to the previously installed version
@@ -749,6 +752,11 @@
 	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
 		-h _WINBINDD_PROTO_H_ nsswitch/winbindd_proto.h \
 		$(WINBINDD_OBJ1)
+
+rpc_client_proto:
+	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
+		-h _RPC_CLIENT_PROTO_H_ include/rpc_client_proto.h \
+		$(RPC_CLIENT_OBJ)
 
 proto: 
 	@echo rebuilding include/proto.h
diff -uNr samba-2.2.5.org/source/acconfig.h samba-2.2.5/source/acconfig.h
--- samba-2.2.5.org/source/acconfig.h	Wed Jun 19 10:13:24 2002
+++ samba-2.2.5/source/acconfig.h	Tue Jul 16 13:46:42 2002
@@ -19,6 +19,7 @@
 #undef HAVE_CONNECT
 #undef HAVE_SHORT_INO_T
 #undef WITH_SMBWRAPPER
+#undef WITH_WINBIND_AUTH_CRAP
 #undef WITH_AFS
 #undef WITH_DFS
 #undef SUNOS5
@@ -31,6 +32,7 @@
 #undef HPUX
 #undef QNX
 #undef SCO
+#undef UNIXWARE
 #undef OSF1
 #undef NEXT2
 #undef RELIANTUNIX
@@ -59,9 +61,6 @@
 #undef WITH_SYSLOG
 #undef WITH_PROFILE
 #undef WITH_SSL
-#undef WITH_LDAP
-#undef WITH_NISPLUS
-#undef WITH_TDBPWD
 #undef WITH_PAM
 #undef WITH_PAM_SMBPASS
 #undef WITH_NISPLUS_HOME
@@ -75,10 +74,8 @@
 #undef HAVE_VA_COPY
 #undef HAVE_SETRESUID_DECL
 #undef HAVE_SETRESUID
-#undef WITH_NETATALK
 #undef WITH_UTMP
 #undef WITH_MSDFS
-#undef WITH_VFS
 #undef HAVE_INO64_T
 #undef HAVE_DEV64_T
 #undef HAVE_STRUCT_FLOCK64
diff -uNr samba-2.2.5.org/source/client/client.c samba-2.2.5/source/client/client.c
--- samba-2.2.5.org/source/client/client.c	Wed Jun 19 10:13:42 2002
+++ samba-2.2.5/source/client/client.c	Tue Jul 16 13:46:42 2002
@@ -1475,7 +1475,7 @@
 	pstrcpy(mask,cur_dir);
 	
 	if (!next_token(NULL,buf,NULL,sizeof(buf))) {
-		DEBUG(0,("del <filename>\n"));
+		DEBUG(0,("open <filename>\n"));
 		return;
 	}
 	pstrcat(mask,buf);
diff -uNr samba-2.2.5.org/source/configure.in samba-2.2.5/source/configure.in
--- samba-2.2.5.org/source/configure.in	Wed Jun 19 10:13:42 2002
+++ samba-2.2.5/source/configure.in	Tue Jul 16 13:46:43 2002
@@ -165,6 +165,7 @@
 AC_SUBST(SHLIBEXT)
 AC_SUBST(BLDSHARED)
 AC_SUBST(LIBSMBCLIENT_SHARED)
+AC_SUBST(LIBSMBCLIENT_NON_SHARED)
 AC_SUBST(LIBSMBCLIENT)
 
 # compile with optimization and without debugging by default
@@ -970,7 +971,7 @@
 AC_MSG_CHECKING([linker flags for shared libraries])
 AC_MSG_RESULT([$LDSHFLAGS])
 AC_MSG_CHECKING([compiler flags for position-independent code])
-AC_MSG_RESULT([$PICFLAGS])
+AC_MSG_RESULT([$PICFLAG])
 
 # try to work out how to produce pic code with this compiler
 if test x$PICFLAG = x; then
@@ -1117,7 +1118,7 @@
 main() { dev_t dev = makedev(1,2); return 0; }],
 samba_cv_HAVE_MAKEDEV_FN=yes,samba_cv_HAVE_MAKEDEV_FN=no,samba_cv_HAVE_MAKEDEV_FN=cross)])
 if test x"$samba_cv_HAVE_MAKEDEV_FN" = x"yes"; then
-    AC_DEFINE(MAKEDEV_FN)
+    AC_DEFINE(HAVE_MAKEDEV_FN)
 fi
 
 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
@@ -1823,6 +1824,10 @@
 	   WRAPPROG=""
 	   WRAP=""
 	   WRAP32=""
+	elif test x"$BLDSHARED" = x"false"; then
+	   AC_MSG_RESULT([No shared library support - disabling smbwrapper])
+	   WRAP=""
+	   WRAP32=""
 	fi
     ;;
   *)
@@ -1993,9 +1998,12 @@
        elif test x$ac_cv_lib_pam_pam_get_data = xno; then
           AC_MSG_RESULT([No libpam found -- disabling pam_smbpass])
           PAM_MOD=""
+       elif test x"$BLDSHARED" = x"false"; then
+          AC_MSG_RESULT([No shared library support - disabling pam_smbpass])
+          PAM_MOD=""
        else
           AC_DEFINE(WITH_PAM_SMBPASS)
-          PAM_MOD="bin/pam_smbpass.so"
+          PAM_MOD="bin/pam_smbpass.$SHLIBEXT"
        fi
     ;;
   *)
@@ -2181,7 +2189,7 @@
 	  LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
 	;;
         * )
-  	  LDFLAGS="-L${withval}/lib $LDFLAGS"
+  	  LDFLAGS="-L${withval} $LDFLAGS"
 	;;
 	esac
 
@@ -2191,7 +2199,7 @@
 
     fi
 
-    LIBS="-lssl -lcrypto $LIBS"
+    LIBS="$LIBS -lssl -lcrypto"
 
 #    if test ! -d ${withval}; then
 #      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
@@ -2303,6 +2311,7 @@
 # should we build libsmbclient?
 
 LIBSMBCLIENT_SHARED=
+LIBSMBCLIENT_NON_SHARED=
 LIBSMBCLIENT=
 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
 AC_ARG_WITH(libsmbclient,
@@ -2311,6 +2320,7 @@
   yes)
      if test $BLDSHARED = true; then
         LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
+	LIBSMBCLIENT_NON_SHARED=bin/libsmbclient.a
 	LIBSMBCLIENT=libsmbclient
         AC_MSG_RESULT(yes)
      else
@@ -2714,19 +2724,28 @@
 	WINBIND_STARGETS="bin/winbindd"
 	case "$host_os" in
         *irix*)
-		WINBIND_LTARGETS="nsswitch/libns_winbind.so"
+		WINBIND_LTARGETS="nsswitch/libns_winbind.$SHLIBEXT"
                 ;;
         *)
-		WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
+		WINBIND_LTARGETS="nsswitch/libnss_winbind.$SHLIBEXT"
                 ;;
 	esac
 
 
 	case "$with_pam" in
 		yes)
-			WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
+			WINBIND_PAM_TARGETS="nsswitch/pam_winbind.$SHLIBEXT"
+		;;
+		*)
+			WINBIND_PAM_TARGETS=""
 		;;
 	esac
+
+	if test x"$BLDSHARED" = x"false"; then
+		AC_MSG_RESULT([No shared library support - disabling pam_winbind])
+		WINBIND_LTARGETS=""
+		WINBIND_PAM_TARGETS=""
+	fi
 else
         AC_MSG_RESULT(no$winbind_no_reason)
 
diff -uNr samba-2.2.5.org/source/lib/messages.c samba-2.2.5/source/lib/messages.c
--- samba-2.2.5.org/source/lib/messages.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/lib/messages.c	Tue Jul 16 13:46:43 2002
@@ -474,7 +474,7 @@
   lock the messaging tdb based on a string - this is used as a primitive form of mutex
   between smbd instances. 
 */
-BOOL message_named_mutex(const char *name, unsigned int timeout)
+BOOL message_named_mutex(char *name, unsigned int timeout)
 {
 	TDB_DATA key;
 	int ret;
@@ -482,7 +482,7 @@
 	if (!message_init())
 		return False;
 
-	key.dptr = (char *)name;
+	key.dptr = name;
 	key.dsize = strlen(name)+1;
 
 	if (timeout) {
diff -uNr samba-2.2.5.org/source/lib/util.c samba-2.2.5/source/lib/util.c
--- samba-2.2.5.org/source/lib/util.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/lib/util.c	Tue Jul 16 13:46:43 2002
@@ -837,11 +837,11 @@
  Based on a fix from <Thomas.Hepper at icem.de>.
 *******************************************************************/
 
-static void strip_mount_options( pstring *str)
+static void strip_mount_options( pstring str)
 {
-  if (**str == '-')
+  if (*str == '-')
   { 
-    char *p = *str;
+    char *p = str;
     while(*p && !isspace(*p))
       p++;
     while(*p && isspace(*p))
@@ -850,7 +850,7 @@
       pstring tmp_str;
 
       pstrcpy(tmp_str, p);
-      pstrcpy(*str, tmp_str);
+      pstrcpy(str, tmp_str);
     }
   }
 }
@@ -905,7 +905,7 @@
     nis_freeresult(result);
   }
 
-  strip_mount_options(&last_value);
+  strip_mount_options(last_value);
 
   DEBUG(4, ("NIS+ Lookup: %s resulted in %s\n", user_name, last_value));
   return last_value;
@@ -945,7 +945,7 @@
        fstrcpy(last_key, user_name);
        strncpy(last_value, nis_result, nis_result_len);
        last_value[nis_result_len] = '\0';
-        strip_mount_options(&last_value);
+        strip_mount_options(last_value);
 
     } else if(nis_error == YPERR_KEY) {
 
diff -uNr samba-2.2.5.org/source/libsmb/cli_netlogon.c samba-2.2.5/source/libsmb/cli_netlogon.c
--- samba-2.2.5.org/source/libsmb/cli_netlogon.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/libsmb/cli_netlogon.c	Tue Jul 16 13:46:43 2002
@@ -443,7 +443,7 @@
                               0, /* param_ctrl */
                               0xdead, 0xbeef, /* LUID? */
                               username, cli->clnt_name_slash,
-                              (char *)cli->sess_key, lm_owf_user_pwd,
+                              cli->sess_key, lm_owf_user_pwd,
                               nt_owf_user_pwd);
 
                 break;
@@ -455,8 +455,8 @@
 
                 generate_random_buffer(chal, 8, False);
 
-                SMBencrypt((const uchar *)password, chal, local_lm_response);
-                SMBNTencrypt((const uchar *)password, chal, local_nt_response);
+                SMBencrypt(password, chal, local_lm_response);
+                SMBNTencrypt(password, chal, local_nt_response);
 
                 init_id_info2(&ctr.auth.id2, lp_workgroup(), 
                               0, /* param_ctrl */
diff -uNr samba-2.2.5.org/source/libsmb/cliconnect.c samba-2.2.5/source/libsmb/cliconnect.c
--- samba-2.2.5.org/source/libsmb/cliconnect.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/libsmb/cliconnect.c	Tue Jul 16 13:46:43 2002
@@ -64,7 +64,7 @@
 		/* Encrypted mode needed, and non encrypted password supplied. */
 		passlen = 24;
 		clistr_push(cli, pword, pass, -1, STR_CONVERT|STR_TERMINATE);
-		SMBencrypt((uchar *)pword,cli->cryptkey,(uchar *)pword);
+		SMBencrypt(pword,cli->cryptkey,(uchar *)pword);
 	} else if ((cli->sec_mode & 2) && passlen == 24) {
 		/* Encrypted mode needed, and encrypted password supplied. */
 		memcpy(pword, pass, passlen);
@@ -89,7 +89,7 @@
 	p = smb_buf(cli->outbuf);
 	memcpy(p,pword,passlen);
 	p += passlen;
-	p += clistr_push(cli, p, user, -1, STR_TERMINATE);
+	p += clistr_push(cli, p, user, -1, STR_CONVERT|STR_TERMINATE);
 	cli_setup_bcc(cli, p);
 
 	cli_send_smb(cli);
@@ -260,8 +260,8 @@
 		ntpasslen = 24;
 		clistr_push(cli, pword, pass, sizeof(pword), STR_TERMINATE|STR_CONVERT);
 		clistr_push(cli, ntpword, ntpass, sizeof(ntpword), STR_TERMINATE|STR_CONVERT);
-		SMBencrypt((uchar *)pword,cli->cryptkey,(uchar *)pword);
-		SMBNTencrypt((uchar *)ntpword,cli->cryptkey,(uchar *)ntpword);
+		SMBencrypt(pword,cli->cryptkey,(uchar *)pword);
+		SMBNTencrypt(ntpword,cli->cryptkey,(uchar *)ntpword);
 	} else {
 		memcpy(pword, pass, passlen);
 		memcpy(ntpword, ntpass, ntpasslen);
@@ -418,7 +418,7 @@
 		 */
 		passlen = 24;
 		clistr_push(cli, dos_pword, pass, -1, STR_CONVERT|STR_TERMINATE);
-		SMBencrypt((uchar *)dos_pword,cli->cryptkey,(uchar *)pword);
+		SMBencrypt(dos_pword,cli->cryptkey,(uchar *)pword);
 	} else {
 		if((cli->sec_mode & 3) == 0) {
 			/*
diff -uNr samba-2.2.5.org/source/libsmb/clifile.c samba-2.2.5/source/libsmb/clifile.c
--- samba-2.2.5.org/source/libsmb/clifile.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/libsmb/clifile.c	Tue Jul 16 13:46:43 2002
@@ -54,7 +54,7 @@
 		-1, 0,                          /* fid, flags */
 		&setup, 1, 0,                   /* setup, length, max */
 		param, param_len, 2,            /* param, length, max */
-		(char *)&data,  data_len, cli->max_xmit /* data, length, max */
+		(char *)data,  data_len, cli->max_xmit /* data, length, max */
 		)) {
 			return False;
 	}
@@ -151,7 +151,7 @@
 		-1, 0,                          /* fid, flags */
 		&setup, 1, 0,                   /* setup, length, max */
 		param, param_len, 2,            /* param, length, max */
-		(char *)&data,  data_len, cli->max_xmit /* data, length, max */
+		(char *)data,  data_len, cli->max_xmit /* data, length, max */
 		)) {
 			return False;
 	}
@@ -408,7 +408,7 @@
 	p = smb_buf(cli->outbuf);
 	/* this alignment and termination is critical for netapp filers. Don't change */
 	p += clistr_align_out(cli, p, 0);
-	len = clistr_push(cli, p, fname, -1, 0);
+	len = clistr_push(cli, p, fname, -1, STR_CONVERT);
 	p += len;
 	SSVAL(cli->outbuf,smb_ntcreate_NameLength, len);
 	/* sigh. this copes with broken netapp filer behaviour */
diff -uNr samba-2.2.5.org/source/libsmb/climessage.c samba-2.2.5/source/libsmb/climessage.c
--- samba-2.2.5.org/source/libsmb/climessage.c	Sun Feb  3 09:46:43 2002
+++ samba-2.2.5/source/libsmb/climessage.c	Tue Jul 16 13:46:43 2002
@@ -41,9 +41,9 @@
 	
 	p = smb_buf(cli->outbuf);
 	*p++ = 4;
-	p += clistr_push(cli, p, username, -1, STR_TERMINATE);
+	p += clistr_push(cli, p, username, -1, STR_CONVERT|STR_TERMINATE);
 	*p++ = 4;
-	p += clistr_push(cli, p, host, -1, STR_TERMINATE);
+	p += clistr_push(cli, p, host, -1, STR_CONVERT|STR_TERMINATE);
 	
 	cli_setup_bcc(cli, p);
 	
diff -uNr samba-2.2.5.org/source/libsmb/clistr.c samba-2.2.5/source/libsmb/clistr.c
--- samba-2.2.5.org/source/libsmb/clistr.c	Fri May  3 10:03:14 2002
+++ samba-2.2.5/source/libsmb/clistr.c	Tue Jul 16 13:46:43 2002
@@ -73,16 +73,13 @@
 
 	/* the server likes unicode. give it the works */
 	if (flags & STR_CONVERT)
-		dos_PutUniCode(dest, unix_to_dos_static(src), dest_len, flags & STR_TERMINATE);
+		len += dos_PutUniCode(dest, unix_to_dos_static(src), dest_len, flags & STR_TERMINATE);
 	else
-		unix_PutUniCode(dest, src, dest_len, flags & STR_TERMINATE);
+		len += unix_PutUniCode(dest, src, dest_len, flags & STR_TERMINATE);
 
 	if (flags & STR_UPPER)
 		strupper_w(dest);
 
-	len += strlen(src)*2;
-	if (flags & STR_TERMINATE)
-		len += 2;
 	return len;
 }
 
diff -uNr samba-2.2.5.org/source/libsmb/libsmbclient.c samba-2.2.5/source/libsmb/libsmbclient.c
--- samba-2.2.5.org/source/libsmb/libsmbclient.c	Fri May  3 10:03:14 2002
+++ samba-2.2.5/source/libsmb/libsmbclient.c	Tue Jul 16 13:46:43 2002
@@ -1468,7 +1468,7 @@
   
 	strncpy(dirent->name, (name?name:""), dirent->namelen + 1);
 
-	dirent->comment = (char *)(&dirent->name + dirent->namelen + 1);
+	dirent->comment = (char *)(dirent->name + dirent->namelen + 1);
 	strncpy(dirent->comment, (comment?comment:""), dirent->commentlen + 1);
 
 	return 0;
@@ -1942,7 +1942,7 @@
 
 		memcpy(smbc_local_dirent, dirent, dirent->dirlen); /* Copy the dirent */
 		dirp = (struct smbc_dirent *)smbc_local_dirent;
-		dirp->comment = (char *)(&dirp->name + dirent->namelen + 1);
+		dirp->comment = (char *)(dirp->name + dirent->namelen + 1);
 		fe->dir_next = fe->dir_next->next;
 
 		return (struct smbc_dirent *)smbc_local_dirent;
@@ -2032,7 +2032,7 @@
 		memcpy(ndir, dirent, reqd); /* Copy the data in ... */
     
 		((struct smbc_dirent *)ndir)->comment = 
-			(char *)(&((struct smbc_dirent *)ndir)->name + dirent->namelen + 1);
+			(char *)(((struct smbc_dirent *)ndir)->name + dirent->namelen + 1);
 
 		ndir += reqd;
 
diff -uNr samba-2.2.5.org/source/libsmb/smbencrypt.c samba-2.2.5/source/libsmb/smbencrypt.c
--- samba-2.2.5.org/source/libsmb/smbencrypt.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/libsmb/smbencrypt.c	Tue Jul 16 13:46:43 2002
@@ -28,13 +28,13 @@
    This implements the X/Open SMB password encryption
    It takes a password, a 8 byte "crypt key" and puts 24 bytes of 
    encrypted password into p24 */
-void SMBencrypt(const uchar *passwd, uchar *c8, uchar *p24)
+void SMBencrypt(const char *passwd, uchar *c8, uchar *p24)
 {
 	uchar p14[15], p21[21];
 
 	memset(p21,'\0',21);
 	memset(p14,'\0',14);
-	StrnCpy((char *)p14,(const char *)passwd,14);
+	StrnCpy((char *)p14,passwd,14);
 
 	strupper((char *)p14);
 	E_P16(p14, p21); 
@@ -53,17 +53,17 @@
  * Creates the MD4 Hash of the users password in NT UNICODE.
  */
  
-void E_md4hash(const uchar *passwd, uchar *p16)
+void E_md4hash(const char *passwd, uchar *p16)
 {
 	int len;
 	int16 wpwd[129];
 	
 	/* Password cannot be longer than 128 characters */
-	len = strlen((const char *)passwd);
+	len = strlen(passwd);
 	if(len > 128)
 		len = 128;
 	/* Password must be converted to NT unicode - null terminated. */
-	dos_struni2((char *)wpwd, (const char *)passwd, 256);
+	dos_struni2((char *)wpwd, passwd, 256);
 	/* Calculate length in bytes */
 	len = strlen_w((const smb_ucs2_t *)wpwd) * sizeof(int16);
 
@@ -71,7 +71,7 @@
 }
 
 /* Does both the NT and LM owfs of a user's password */
-void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16])
+void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar p16[16])
 {
 	char passwd[514];
 
@@ -80,7 +80,7 @@
 
 	/* Calculate the MD4 hash (NT compatible) of the password */
 	memset(nt_p16, '\0', 16);
-	E_md4hash((uchar *)passwd, nt_p16);
+	E_md4hash(passwd, nt_p16);
 
 #ifdef DEBUG_PASSWORD
 	DEBUG(100,("nt_lm_owf_gen: pwd, nt#\n"));
@@ -138,7 +138,7 @@
 
 /* Does the NT MD4 hash then des encryption. */
  
-void SMBNTencrypt(const uchar *passwd, uchar *c8, uchar *p24)
+void SMBNTencrypt(const char *passwd, uchar *c8, uchar *p24)
 {
 	uchar p21[21];
  
@@ -243,9 +243,9 @@
 	  If you reuse that code somewhere else check first.
 	*/
 
-	ZERO_STRUCT(unicode_passwd);
-	ZERO_STRUCT(lm_ascii_passwd);
-	ZERO_STRUCT(passwd);
+	ZERO_ARRAY(unicode_passwd);
+	ZERO_ARRAY(lm_ascii_passwd);
+	ZERO_ARRAY(passwd);
 
 	memset(nt_p16, '\0', 16);
 	memset(p16, '\0', 16);
@@ -304,9 +304,9 @@
 	
 	
 	/* clear out local copy of user's password (just being paranoid). */
-	ZERO_STRUCT(unicode_passwd);
-	ZERO_STRUCT(lm_ascii_passwd);
-	ZERO_STRUCT(passwd);
+	ZERO_ARRAY(unicode_passwd);
+	ZERO_ARRAY(lm_ascii_passwd);
+	ZERO_ARRAY(passwd);
 	
 	return True;
 
@@ -325,5 +325,5 @@
 	mdfour(nt_p16, (unsigned char *)buf, pwd->uni_str_len * 2);
  
 	/* clear out local copy of user's password (just being paranoid). */
-	ZERO_STRUCT(buf);
+	ZERO_ARRAY(buf);
 }
diff -uNr samba-2.2.5.org/source/nsswitch/pam_winbind.c samba-2.2.5/source/nsswitch/pam_winbind.c
--- samba-2.2.5.org/source/nsswitch/pam_winbind.c	Fri May  3 10:03:19 2002
+++ samba-2.2.5/source/nsswitch/pam_winbind.c	Tue Jul 16 13:46:43 2002
@@ -79,7 +79,7 @@
 }
 
 
-int _make_remark(pam_handle_t * pamh, int type, const char *text)
+int _make_remark(pam_handle_t * pamh, int type, char *text)
 {
 	int retval = PAM_SUCCESS;
 
@@ -134,7 +134,7 @@
 }
 
 /* talk to winbindd */
-static int winbind_auth_request(const char *user, const char *pass, int ctrl)
+static int winbind_auth_request(char *user, char *pass, int ctrl)
 {
 	struct winbindd_request request;
 	struct winbindd_response response;
@@ -216,7 +216,7 @@
  *	 0  = OK
  * 	-1  = System error
  */
-static int valid_user(const char *user)
+static int valid_user(char *user)
 {
 	if (getpwnam(user)) return 0;
 	return 1;
@@ -235,14 +235,14 @@
 
 int _winbind_read_password(pam_handle_t * pamh
 			,unsigned int ctrl
-			,const char *comment
-			,const char *prompt1
-			,const char *prompt2
-			,const char **pass)
+			,char *comment
+			,char *prompt1
+			,char *prompt2
+			,char **pass)
 {
 	int authtok_flag;
 	int retval;
-	const char *item;
+	char *item;
 	char *token;
 
 	/*
@@ -385,15 +385,15 @@
 int pam_sm_authenticate(pam_handle_t *pamh, int flags,
 			int argc, const char **argv)
 {
-     const char *username;
-     const char *password;
+     char *username;
+     char *password;
      int retval = PAM_AUTH_ERR;
     
      /* parse arguments */
      int ctrl = _pam_parse(argc, argv);
 
      /* Get the username */
-     retval = pam_get_user(pamh, &username, NULL);
+     retval = pam_get_user(pamh, (const char **)&username, NULL);
      if ((retval != PAM_SUCCESS) || (!username)) {
         if (ctrl & WINBIND_DEBUG_ARG)
             _pam_log(LOG_DEBUG,"can not get the username");
@@ -440,14 +440,14 @@
 int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
 		   int argc, const char **argv)
 {
-    const char *username;
+    char *username;
     int retval = PAM_USER_UNKNOWN;
 
     /* parse arguments */
     int ctrl = _pam_parse(argc, argv);
 
     /* Get the username */
-    retval = pam_get_user(pamh, &username, NULL);
+    retval = pam_get_user(pamh, (const char **)&username, NULL);
     if ((retval != PAM_SUCCESS) || (!username)) {
 	if (ctrl & WINBIND_DEBUG_ARG)
 	    _pam_log(LOG_DEBUG,"can not get the username");
@@ -511,7 +511,7 @@
 	unsigned int ctrl = _pam_parse(argc, argv);
 
 	/* <DO NOT free() THESE> */
-	const char *user;
+	char *user;
 	char *pass_old, *pass_new;
 	/* </DO NOT free() THESE> */
 
@@ -522,7 +522,7 @@
 	/*
 	 * First get the name of a user
 	 */
-	retval = pam_get_user(pamh, &user, "Username: ");
+	retval = pam_get_user(pamh, (const char **)&user, "Username: ");
 	if (retval == PAM_SUCCESS) {
 		if (user == NULL) {
 			_pam_log(LOG_ERR, "username was NULL!");
@@ -562,7 +562,7 @@
 						,Announce
 						,"(current) NT password: "
 						,NULL
-						,(const char **) &pass_old);
+						,&pass_old);
 		free(Announce);
 		
 		if (retval != PAM_SUCCESS) {
@@ -622,7 +622,7 @@
 							,NULL
 							,"Enter new NT password: "
 							,"Retype new NT password: "
-							,(const char **) &pass_new);
+							,&pass_new);
 			
 			if (retval != PAM_SUCCESS) {
 				if (on(WINBIND_DEBUG_ARG, ctrl)) {
diff -uNr samba-2.2.5.org/source/nsswitch/wb_client.c samba-2.2.5/source/nsswitch/wb_client.c
--- samba-2.2.5.org/source/nsswitch/wb_client.c	Fri May  3 10:03:20 2002
+++ samba-2.2.5/source/nsswitch/wb_client.c	Tue Jul 16 13:46:43 2002
@@ -257,6 +257,7 @@
 
 	/* Call winbindd */
 
+	ZERO_STRUCT(request);
 	fstrcpy(request.data.username, user);
 
 	ZERO_STRUCT(response);
diff -uNr samba-2.2.5.org/source/nsswitch/wbinfo.c samba-2.2.5/source/nsswitch/wbinfo.c
--- samba-2.2.5.org/source/nsswitch/wbinfo.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/nsswitch/wbinfo.c	Tue Jul 16 13:46:43 2002
@@ -118,6 +118,7 @@
 	NSS_STATUS result;
 	int i;
 	
+	ZERO_STRUCT(request);
 	ZERO_STRUCT(response);
 
 	/* Send request */
@@ -492,9 +493,9 @@
 
 	generate_random_buffer(request.data.auth_crap.chal, 8, False);
         
-        SMBencrypt((uchar *)pass, request.data.auth_crap.chal, 
+        SMBencrypt(pass, request.data.auth_crap.chal, 
                    (uchar *)request.data.auth_crap.lm_resp);
-        SMBNTencrypt((uchar *)pass, request.data.auth_crap.chal,
+        SMBNTencrypt(pass, request.data.auth_crap.chal,
                      (uchar *)request.data.auth_crap.nt_resp);
 
         request.data.auth_crap.lm_resp_len = 24;
diff -uNr samba-2.2.5.org/source/nsswitch/winbind_nss.c samba-2.2.5/source/nsswitch/winbind_nss.c
--- samba-2.2.5.org/source/nsswitch/winbind_nss.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/nsswitch/winbind_nss.c	Tue Jul 16 13:46:43 2002
@@ -526,7 +526,7 @@
    are the pointers passed in by the C library to the _nss_ntdom_*
    functions. */
 
-static char *get_static(char **buffer, int *buflen, int len)
+static char *get_static(char **buffer, size_t *buflen, int len)
 {
 	char *result;
 
@@ -592,7 +592,7 @@
 
 static NSS_STATUS fill_pwent(struct passwd *result,
 				  struct winbindd_pw *pw,
-				  char **buffer, int *buflen)
+				  char **buffer, size_t *buflen)
 {
 	/* User name */
 
@@ -678,7 +678,7 @@
    Return NSS_STATUS_TRYAGAIN if we run out of memory. */
 
 static int fill_grent(struct group *result, struct winbindd_gr *gr,
-		      char *gr_mem, char **buffer, int *buflen)
+		      char *gr_mem, char **buffer, size_t *buflen)
 {
 	fstring name;
 	int i;
@@ -867,7 +867,7 @@
 		}
 
 		ret = fill_pwent(result, &pw_cache[ndx_pw_cache],
- &buffer, (int *)&buflen);
+ &buffer, &buflen);
 		
 		/* Out of memory - try again */
 
@@ -917,7 +917,7 @@
 
 		if (ret == NSS_STATUS_SUCCESS) {
 			ret = fill_pwent(result, &response.data.pw, 
-					&buffer, (int *)&buflen);
+					&buffer, &buflen);
 
 			if (ret == NSS_STATUS_TRYAGAIN) {
 				keep_response = True;
@@ -930,7 +930,7 @@
 
 		/* We've been called again */
 
-		ret = fill_pwent(result, &response.data.pw, &buffer, (int *)&buflen);
+		ret = fill_pwent(result, &response.data.pw, &buffer, &buflen);
 
 		if (ret == NSS_STATUS_TRYAGAIN) {
 			keep_response = True;
@@ -970,7 +970,7 @@
 		ZERO_STRUCT(response);
 		ZERO_STRUCT(request);
 
-		strncpy(request.data.username, name, 
+		strncpy((char *)request.data.username, name, 
 			sizeof(request.data.username) - 1);
 		request.data.username
 			[sizeof(request.data.username) - 1] = '\0';
@@ -979,7 +979,7 @@
 
 		if (ret == NSS_STATUS_SUCCESS) {
 			ret = fill_pwent(result, &response.data.pw, &buffer,
-					(int *)&buflen);
+					&buflen);
 
 			if (ret == NSS_STATUS_TRYAGAIN) {
 				keep_response = True;
@@ -992,7 +992,7 @@
 
 		/* We've been called again */
 
-		ret = fill_pwent(result, &response.data.pw, &buffer, (int *)&buflen);
+		ret = fill_pwent(result, &response.data.pw, &buffer, &buflen);
 
 		if (ret == NSS_STATUS_TRYAGAIN) {
 			keep_response = True;
@@ -1116,7 +1116,7 @@
 
 		ret = fill_grent(result, &gr_cache[ndx_gr_cache],
 				 ((char *)getgrent_response.extra_data)+mem_ofs,
-				&buffer, (int *)&buflen);
+				&buffer, &buflen);
 		
 		/* Out of memory - try again */
 
@@ -1176,7 +1176,7 @@
 		if (ret == NSS_STATUS_SUCCESS) {
 			ret = fill_grent(result, &response.data.gr, 
 					 response.extra_data,
-					&buffer, (int *)&buflen);
+					&buffer, &buflen);
 
 			if (ret == NSS_STATUS_TRYAGAIN) {
 				keep_response = True;
@@ -1190,7 +1190,7 @@
 		/* We've been called again */
 		
 		ret = fill_grent(result, &response.data.gr, 
-				response.extra_data, &buffer, (int *)&buflen);
+				response.extra_data, &buffer, &buflen);
 		
 		if (ret == NSS_STATUS_TRYAGAIN) {
 			keep_response = True;
@@ -1239,7 +1239,7 @@
 
 			ret = fill_grent(result, &response.data.gr, 
 					 response.extra_data, 
-					&buffer, (int *)&buflen);
+					&buffer, &buflen);
 
 			if (ret == NSS_STATUS_TRYAGAIN) {
 				keep_response = True;
@@ -1253,7 +1253,7 @@
 		/* We've been called again */
 
 		ret = fill_grent(result, &response.data.gr, 
-				response.extra_data, &buffer, (int *)&buflen);
+				response.extra_data, &buffer, &buflen);
 
 		if (ret == NSS_STATUS_TRYAGAIN) {
 			keep_response = True;
diff -uNr samba-2.2.5.org/source/nsswitch/winbind_nss_config.h samba-2.2.5/source/nsswitch/winbind_nss_config.h
--- samba-2.2.5.org/source/nsswitch/winbind_nss_config.h	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/nsswitch/winbind_nss_config.h	Tue Jul 16 13:46:43 2002
@@ -149,7 +149,7 @@
 #endif
 
 #ifndef S_ISSOCK
-#define S_ISSOCK(mode)  ((mode & S_IFSOCK) == S_IFSOCK)
+#define S_ISSOCK(mode)  ((mode & 0xF000) == S_IFSOCK)
 #endif
 
 #endif
diff -uNr samba-2.2.5.org/source/nsswitch/winbindd.c samba-2.2.5/source/nsswitch/winbindd.c
--- samba-2.2.5.org/source/nsswitch/winbindd.c	Wed Jun 19 10:13:44 2002
+++ samba-2.2.5/source/nsswitch/winbindd.c	Tue Jul 16 13:46:43 2002
@@ -688,6 +688,7 @@
 	extern pstring global_myname;
 	extern fstring global_myworkgroup;
 	extern BOOL append_log;
+	extern char *optarg;
 	pstring logfile;
 	int accept_sock;
 	BOOL interactive = False;
diff -uNr samba-2.2.5.org/source/nsswitch/winbindd_pam.c samba-2.2.5/source/nsswitch/winbindd_pam.c
--- samba-2.2.5.org/source/nsswitch/winbindd_pam.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/nsswitch/winbindd_pam.c	Tue Jul 16 13:46:43 2002
@@ -68,9 +68,9 @@
 		unsigned char local_nt_response[24];
 		
 		generate_random_buffer(chal, 8, False);
-		SMBencrypt( (const uchar *)state->request.data.auth.pass, chal, local_lm_response);
+		SMBencrypt(state->request.data.auth.pass, chal, local_lm_response);
 		
-		SMBNTencrypt((const uchar *)state->request.data.auth.pass, chal, local_nt_response);
+		SMBNTencrypt(state->request.data.auth.pass, chal, local_nt_response);
 
 		lm_resp = data_blob_talloc(mem_ctx, local_lm_response, sizeof(local_lm_response));
 		nt_resp = data_blob_talloc(mem_ctx, local_nt_response, sizeof(local_nt_response));
diff -uNr samba-2.2.5.org/source/nsswitch/winbindd_util.c samba-2.2.5/source/nsswitch/winbindd_util.c
--- samba-2.2.5.org/source/nsswitch/winbindd_util.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/nsswitch/winbindd_util.c	Tue Jul 16 13:46:43 2002
@@ -121,7 +121,7 @@
 	struct winbindd_domain *domain;
 	DOM_SID *dom_sids;
 	char **names;
-	int num_domains = 0;
+	uint32 num_domains = 0;
 
 	if (!(mem_ctx = talloc_init_named("init_domain_list")))
 		return False;
@@ -151,7 +151,7 @@
 
 	DEBUG(1, ("getting trusted domain list\n"));
 
-	result = cache_methods.trusted_domains(domain, mem_ctx, (uint *)&num_domains,
+	result = cache_methods.trusted_domains(domain, mem_ctx, &num_domains,
 					       &names, &dom_sids);
 
 	/* Add each domain to the trusted domain list */
diff -uNr samba-2.2.5.org/source/pam_smbpass/pam_smb_acct.c samba-2.2.5/source/pam_smbpass/pam_smb_acct.c
--- samba-2.2.5.org/source/pam_smbpass/pam_smb_acct.c	Fri May  3 10:03:24 2002
+++ samba-2.2.5/source/pam_smbpass/pam_smb_acct.c	Tue Jul 16 13:46:43 2002
@@ -44,7 +44,7 @@
     unsigned int ctrl;
     int retval;
 
-    const char *name;
+    char *name;
     SAM_ACCOUNT *sampass = NULL;
 
     extern BOOL in_client;
@@ -59,7 +59,7 @@
 
     /* get the username */
 
-    retval = pam_get_user( pamh, &name, "Username: " );
+    retval = pam_get_user( pamh, (const char **)&name, "Username: " );
     if (retval != PAM_SUCCESS) {
         if (on( SMB_DEBUG, ctrl )) {
 	    _log_err( LOG_DEBUG, "acct: could not identify user" );
diff -uNr samba-2.2.5.org/source/pam_smbpass/pam_smb_auth.c samba-2.2.5/source/pam_smbpass/pam_smb_auth.c
--- samba-2.2.5.org/source/pam_smbpass/pam_smb_auth.c	Fri May  3 10:03:24 2002
+++ samba-2.2.5/source/pam_smbpass/pam_smb_auth.c	Tue Jul 16 13:46:43 2002
@@ -45,7 +45,7 @@
 } while (0)
 
 static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
-                         const char *name, SAM_ACCOUNT *sampass, BOOL exist);
+                         char *name, SAM_ACCOUNT *sampass, BOOL exist);
 
 int make_remark(pam_handle_t *, unsigned int, int, const char *);
 
@@ -66,7 +66,7 @@
     int retval, *ret_data = NULL;
     SAM_ACCOUNT *sampass = NULL;
     extern BOOL in_client;
-    const char *name;
+    char *name;
     BOOL found;
 
     /* Points to memory managed by the PAM library. Do not free. */
@@ -86,7 +86,7 @@
     ret_data = malloc(sizeof(int));
 
     /* get the username */
-    retval = pam_get_user( pamh, &name, "Username: " );
+    retval = pam_get_user( pamh, (const char **)&name, "Username: " );
     if ( retval != PAM_SUCCESS ) {
         if (on( SMB_DEBUG, ctrl )) {
 	    _log_err(LOG_DEBUG, "auth: could not identify user");
@@ -172,7 +172,7 @@
 
 /* Helper function for adding a user to the db. */
 static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
-                         const char *name, SAM_ACCOUNT *sampass, BOOL exist)
+                         char *name, SAM_ACCOUNT *sampass, BOOL exist)
 {
     pstring err_str;
     pstring msg_str;
diff -uNr samba-2.2.5.org/source/pam_smbpass/pam_smb_passwd.c samba-2.2.5/source/pam_smbpass/pam_smb_passwd.c
--- samba-2.2.5.org/source/pam_smbpass/pam_smb_passwd.c	Fri May  3 10:03:24 2002
+++ samba-2.2.5/source/pam_smbpass/pam_smb_passwd.c	Tue Jul 16 13:46:43 2002
@@ -33,7 +33,7 @@
 
 #include "support.h"
 
-int smb_update_db( pam_handle_t *pamh, int ctrl, const char *user,  char *pass_new )
+int smb_update_db( pam_handle_t *pamh, int ctrl, char *user,  char *pass_new )
 {
  int		retval;
  pstring	err_str;
@@ -92,7 +92,7 @@
     extern BOOL in_client;
 
     SAM_ACCOUNT *sampass = NULL;
-    const char *user;
+    char *user;
     char *pass_old, *pass_new;
 
     /* Samba initialization. */
@@ -108,7 +108,7 @@
      * determine this.
      */
 
-    retval = pam_get_user( pamh, &user, "Username: " );
+    retval = pam_get_user( pamh, (const char **)&user, "Username: " );
     if (retval != PAM_SUCCESS) {
         if (on( SMB_DEBUG, ctrl )) {
             _log_err( LOG_DEBUG, "password: could not identify user" );
diff -uNr samba-2.2.5.org/source/pam_smbpass/support.c samba-2.2.5/source/pam_smbpass/support.c
--- samba-2.2.5.org/source/pam_smbpass/support.c	Fri May  3 10:03:24 2002
+++ samba-2.2.5/source/pam_smbpass/support.c	Tue Jul 16 13:46:43 2002
@@ -130,7 +130,7 @@
 {
     int i = 0;
     static pstring servicesf = CONFIGFILE;
-    const char *service_file = servicesf;
+    char *service_file = servicesf;
     unsigned int ctrl;
 
     ctrl = SMB_DEFAULTS;	/* the default selection of options */
@@ -161,7 +161,7 @@
 	}
 
 	if (j == SMB_CONF_FILE) {
-	    service_file = argv[i] + 8;
+	    service_file = (char *)argv[i] + 8;
 	}
 	i++;
     }
diff -uNr samba-2.2.5.org/source/passdb/passdb.c samba-2.2.5/source/passdb/passdb.c
--- samba-2.2.5.org/source/passdb/passdb.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/passdb/passdb.c	Tue Jul 16 13:46:43 2002
@@ -344,7 +344,7 @@
  into a 16 byte array.
 **************************************************************/
 
-BOOL pdb_gethexpwd(char *p, unsigned char *pwd)
+BOOL pdb_gethexpwd(const char *p, unsigned char *pwd)
 {
 	int i;
 	unsigned char   lonybble, hinybble;
diff -uNr samba-2.2.5.org/source/passdb/pdb_ldap.c samba-2.2.5/source/passdb/pdb_ldap.c
--- samba-2.2.5.org/source/passdb/pdb_ldap.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/passdb/pdb_ldap.c	Tue Jul 16 13:46:43 2002
@@ -929,7 +929,7 @@
 Delete entry from LDAP for username 
 *********************************************************************/
 
-BOOL pdb_delete_sam_account(char *sname)
+BOOL pdb_delete_sam_account(const char *sname)
 {
 	int rc;
 	char *dn;
diff -uNr samba-2.2.5.org/source/passdb/pdb_nisplus.c samba-2.2.5/source/passdb/pdb_nisplus.c
--- samba-2.2.5.org/source/passdb/pdb_nisplus.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/passdb/pdb_nisplus.c	Tue Jul 16 13:46:43 2002
@@ -1045,7 +1045,7 @@
 /*************************************************************************
  Routine to remove entry from the nisplus smbpasswd table
  *************************************************************************/
-BOOL pdb_delete_sam_account(char *sname)
+BOOL pdb_delete_sam_account(const char *sname)
 {
   char *pfile = smb_passwd_table();
   pstring nisname;
diff -uNr samba-2.2.5.org/source/passdb/pdb_smbpasswd.c samba-2.2.5/source/passdb/pdb_smbpasswd.c
--- samba-2.2.5.org/source/passdb/pdb_smbpasswd.c	Sun Feb  3 09:46:49 2002
+++ samba-2.2.5/source/passdb/pdb_smbpasswd.c	Tue Jul 16 13:46:43 2002
@@ -1473,7 +1473,7 @@
 	return True;
 }
 
-BOOL pdb_delete_sam_account (char* username)
+BOOL pdb_delete_sam_account (const char* username)
 {
 	return del_smbfilepwd_entry(username);
 }
diff -uNr samba-2.2.5.org/source/passdb/pdb_tdb.c samba-2.2.5/source/passdb/pdb_tdb.c
--- samba-2.2.5.org/source/passdb/pdb_tdb.c	Fri May  3 10:03:27 2002
+++ samba-2.2.5/source/passdb/pdb_tdb.c	Tue Jul 16 13:46:43 2002
@@ -510,7 +510,7 @@
 	}
   
   	/* unpack the buffer */
-	if (!init_sam_from_buffer(user, data.dptr, data.dsize)) {
+	if (!init_sam_from_buffer(user, (uint8 *)data.dptr, data.dsize)) {
 		DEBUG(0,("pdb_getsampwent: Bad SAM_ACCOUNT entry returned from TDB!\n"));
 		SAFE_FREE(data.dptr);
 		return False;
@@ -573,7 +573,7 @@
 	}
   
   	/* unpack the buffer */
-	if (!init_sam_from_buffer(user, data.dptr, data.dsize)) {
+	if (!init_sam_from_buffer(user, (uint8 *)data.dptr, data.dsize)) {
 		DEBUG(0,("pdb_getsampwent: Bad SAM_ACCOUNT entry returned from TDB!\n"));
 		SAFE_FREE(data.dptr);
 		tdb_close(pwd_tdb);
@@ -640,7 +640,7 @@
  Delete a SAM_ACCOUNT
 ****************************************************************************/
 
-BOOL pdb_delete_sam_account(char *sname)
+BOOL pdb_delete_sam_account(const char *sname)
 {
 	SAM_ACCOUNT	*sam_pass = NULL;
 	TDB_CONTEXT 	*pwd_tdb;
@@ -683,7 +683,7 @@
 		return False;
 	}
 	
-	if (!init_sam_from_buffer (sam_pass, data.dptr, data.dsize)) {
+	if (!init_sam_from_buffer (sam_pass, (uint8 *)data.dptr, data.dsize)) {
 		DEBUG(0,("pdb_getsampwent: Bad SAM_ACCOUNT entry returned from TDB!\n"));
 		tdb_close (pwd_tdb);
 		SAFE_FREE(data.dptr);
@@ -757,7 +757,7 @@
 		ret = False;
 		goto done;
 	}
-	data.dptr = buf;
+	data.dptr = (char *)buf;
 
 	fstrcpy(name,pdb_get_username(newpwd));
 	strlower(name);
diff -uNr samba-2.2.5.org/source/popt/popthelp.c samba-2.2.5/source/popt/popthelp.c
--- samba-2.2.5.org/source/popt/popthelp.c	Wed May  1 00:02:33 2002
+++ samba-2.2.5/source/popt/popthelp.c	Tue Jul 16 13:46:43 2002
@@ -19,7 +19,7 @@
 }
 
 struct poptOption poptHelpOptions[] = {
-    { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL },
+    { NULL, '\0', POPT_ARG_CALLBACK, (void *)displayArgs, '\0', NULL, NULL },
     { "help", '?', 0, NULL, '?', N_("Show this help message"), NULL },
     { "usage", '\0', 0, NULL, 'u', N_("Display brief usage message"), NULL },
     { NULL, '\0', 0, NULL, 0, NULL, NULL }
diff -uNr samba-2.2.5.org/source/printing/nt_printing.c samba-2.2.5/source/printing/nt_printing.c
--- samba-2.2.5.org/source/printing/nt_printing.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/printing/nt_printing.c	Tue Jul 16 13:46:43 2002
@@ -1793,7 +1793,7 @@
 		else driver.dependentfiles = tddfs;
 
 		len += tdb_unpack(dbuf.dptr+len, dbuf.dsize-len, "f",
-				  &driver.dependentfiles[i]);
+				  driver.dependentfiles[i]);
 		i++;
 	}
 	if (driver.dependentfiles != NULL)
@@ -2920,7 +2920,7 @@
 	 * The saved DEVMODE contains the devicename from the printer used during
 	 * the initialization save. Change it to reflect the new printer.
 	 */
-	ZERO_STRUCT(info.devmode->devicename);
+	ZERO_ARRAY(info.devmode->devicename);
 	fstrcpy(info.devmode->devicename, info_ptr->printername);
 
 
diff -uNr samba-2.2.5.org/source/rpc_client/cli_login.c samba-2.2.5/source/rpc_client/cli_login.c
--- samba-2.2.5.org/source/rpc_client/cli_login.c	Wed Jun 19 10:13:45 2002
+++ samba-2.2.5/source/rpc_client/cli_login.c	Tue Jul 16 13:46:43 2002
@@ -52,7 +52,7 @@
   /**************** Long-term Session key **************/
 
   /* calculate the session key */
-  cred_session_key(&clnt_chal, &srv_chal, (uchar *)mach_pwd, cli->sess_key);
+  cred_session_key(&clnt_chal, &srv_chal, mach_pwd, cli->sess_key);
   memset((char *)cli->sess_key+8, '\0', 8);
 
   /******************* Authenticate 2 ********************/
@@ -136,7 +136,7 @@
   init_id_info1(&ctr->auth.id1, domain, 0, 
                 smb_userid_low, 0,
                 username, cli->clnt_name_slash,
-                (char *)cli->sess_key, lm_owf_user_pwd, nt_owf_user_pwd);
+                cli->sess_key, lm_owf_user_pwd, nt_owf_user_pwd);
 
   /* Ensure we overwrite all the plaintext password
      equivalents. */
diff -uNr samba-2.2.5.org/source/rpc_parse/parse_net.c samba-2.2.5/source/rpc_parse/parse_net.c
--- samba-2.2.5.org/source/rpc_parse/parse_net.c	Fri May  3 10:03:35 2002
+++ samba-2.2.5/source/rpc_parse/parse_net.c	Tue Jul 16 13:46:43 2002
@@ -848,7 +848,7 @@
 void init_id_info1(NET_ID_INFO_1 *id, char *domain_name,
 				uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
 				char *user_name, char *wksta_name,
-				char *sess_key,
+				unsigned char *sess_key,
 				unsigned char lm_cypher[16], unsigned char nt_cypher[16])
 {
 	int len_domain_name = strlen(domain_name);
diff -uNr samba-2.2.5.org/source/rpc_parse/parse_samr.c samba-2.2.5/source/rpc_parse/parse_samr.c
--- samba-2.2.5.org/source/rpc_parse/parse_samr.c	Wed Jun 19 10:13:46 2002
+++ samba-2.2.5/source/rpc_parse/parse_samr.c	Tue Jul 16 13:46:43 2002
@@ -5133,20 +5133,20 @@
 	len_mach_acct = strlen(mach_acct);
 
 	memcpy(&(usr->expiry), expiry, sizeof(usr->expiry));	/* expiry time or something? */
-	ZERO_STRUCT(usr->padding_1);	/* 0 - padding 24 bytes */
+	ZERO_ARRAY(usr->padding_1);	/* 0 - padding 24 bytes */
 
 	init_uni_hdr(&usr->hdr_mach_acct, len_mach_acct);	/* unicode header for machine account */
 	usr->padding_2 = 0;	/* 0 - padding 4 bytes */
 
 	usr->ptr_1 = 1;		/* pointer */
-	ZERO_STRUCT(usr->padding_3);	/* 0 - padding 32 bytes */
+	ZERO_ARRAY(usr->padding_3);	/* 0 - padding 32 bytes */
 	usr->padding_4 = 0;	/* 0 - padding 4 bytes */
 
 	usr->ptr_2 = 1;		/* pointer */
 	usr->padding_5 = 0;	/* 0 - padding 4 bytes */
 
 	usr->ptr_3 = 1;		/* pointer */
-	ZERO_STRUCT(usr->padding_6);	/* 0 - padding 32 bytes */
+	ZERO_ARRAY(usr->padding_6);	/* 0 - padding 32 bytes */
 
 	usr->rid_user = rid_user;
 	usr->rid_group = rid_group;
@@ -5157,7 +5157,7 @@
 	usr->unknown_4 = 0x003f;	/* 0x003f      - 16 bit unknown */
 	usr->unknown_5 = 0x003c;	/* 0x003c      - 16 bit unknown */
 
-	ZERO_STRUCT(usr->padding_7);	/* 0 - padding 16 bytes */
+	ZERO_ARRAY(usr->padding_7);	/* 0 - padding 16 bytes */
 	usr->padding_8 = 0;	/* 0 - padding 4 bytes */
 
 	init_unistr2(&usr->uni_mach_acct, mach_acct, len_mach_acct);	/* unicode string for machine account */
@@ -5352,8 +5352,8 @@
 	init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str);
 	init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial);
 
-	ZERO_STRUCT(usr->nt_pwd);
-	ZERO_STRUCT(usr->lm_pwd);
+	ZERO_ARRAY(usr->nt_pwd);
+	ZERO_ARRAY(usr->lm_pwd);
 
 	usr->user_rid = user_rid;	/* 0x0000 0000 */
 	usr->group_rid = group_rid;
@@ -5363,7 +5363,7 @@
 	usr->logon_divs = logon_divs;	/* should be 168 (hours/week) */
 	usr->ptr_logon_hrs = hrs ? 1 : 0;
 
-	ZERO_STRUCT(usr->padding1);
+	ZERO_ARRAY(usr->padding1);
 
 	usr->unknown_5 = unknown_5;	/* 0x0001 0000 */
 
@@ -5440,8 +5440,8 @@
 	init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str);
 	init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial);
 
-	ZERO_STRUCT(usr->nt_pwd);
-	ZERO_STRUCT(usr->lm_pwd);
+	ZERO_ARRAY(usr->nt_pwd);
+	ZERO_ARRAY(usr->lm_pwd);
 
 	usr->user_rid = user_rid;	/* 0x0000 0000 */
 	usr->group_rid = group_rid;
@@ -5451,7 +5451,7 @@
 	usr->logon_divs = logon_divs;	/* should be 168 (hours/week) */
 	usr->ptr_logon_hrs = hrs ? 1 : 0;
 
-	ZERO_STRUCT(usr->padding1);
+	ZERO_ARRAY(usr->padding1);
 
 	usr->unknown_5 = unknown_5;	/* 0x0001 0000 */
 
@@ -5798,7 +5798,7 @@
 	usr->ptr_logon_hrs = hrs ? 1 : 0;
 	usr->unknown_5 = unknown_5;	/* 0x0002 0000 */
 
-	ZERO_STRUCT(usr->padding1);
+	ZERO_ARRAY(usr->padding1);
 
 	copy_unistr2(&usr->uni_user_name, user_name);
 	copy_unistr2(&usr->uni_full_name, full_name);
@@ -5886,8 +5886,8 @@
 	init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str);
 	init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial);
 
-	ZERO_STRUCT(usr->nt_pwd);
-	ZERO_STRUCT(usr->lm_pwd);
+	ZERO_ARRAY(usr->nt_pwd);
+	ZERO_ARRAY(usr->lm_pwd);
 
 	usr->user_rid  = pdb_get_user_rid(pw);
 	usr->group_rid = pdb_get_group_rid(pw);
@@ -5898,7 +5898,7 @@
 	usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
 	usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */
 
-	ZERO_STRUCT(usr->padding1);
+	ZERO_ARRAY(usr->padding1);
 
 	init_unistr2(&usr->uni_user_name, unix_to_dos_static(user_name), len_user_name);
 	init_unistr2(&usr->uni_full_name, unix_to_dos_static(full_name), len_full_name);
@@ -5916,7 +5916,7 @@
 
 	if (pdb_get_hours(pw)) {
 		usr->logon_hrs.len = pdb_get_hours_len(pw);
-		memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
+		memcpy(usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
 	} else
 		memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs));
 }
diff -uNr samba-2.2.5.org/source/rpc_server/srv_netlog_nt.c samba-2.2.5/source/rpc_server/srv_netlog_nt.c
--- samba-2.2.5.org/source/rpc_server/srv_netlog_nt.c	Wed Jun 19 10:13:47 2002
+++ samba-2.2.5/source/rpc_server/srv_netlog_nt.c	Tue Jul 16 13:46:43 2002
@@ -223,7 +223,7 @@
 
 		/* from client / server challenges and md4 password, generate sess key */
 		cred_session_key(&p->dc.clnt_chal, &p->dc.srv_chal,
-				(uchar *)p->dc.md4pw, p->dc.sess_key);
+				p->dc.md4pw, p->dc.sess_key);
 
 		/* Save the machine account name. */
 		fstrcpy(p->dc.mach_acct, mach_acct);
diff -uNr samba-2.2.5.org/source/rpc_server/srv_samr_nt.c samba-2.2.5/source/rpc_server/srv_samr_nt.c
--- samba-2.2.5.org/source/rpc_server/srv_samr_nt.c	Wed Jun 19 10:13:47 2002
+++ samba-2.2.5/source/rpc_server/srv_samr_nt.c	Tue Jul 16 13:46:43 2002
@@ -129,8 +129,8 @@
 		return;
 
 	for (i = 0; i < num_entries; i++) {
-		memset(&pass[i].lm_pwd, '\0', sizeof(pass[i].lm_pwd));
-		memset(&pass[i].nt_pwd, '\0', sizeof(pass[i].nt_pwd));
+		memset(pass[i].lm_pwd, '\0', sizeof(pass[i].lm_pwd));
+		memset(pass[i].nt_pwd, '\0', sizeof(pass[i].nt_pwd));
 	}
 }
 
diff -uNr samba-2.2.5.org/source/rpc_server/srv_spoolss_nt.c samba-2.2.5/source/rpc_server/srv_spoolss_nt.c
--- samba-2.2.5.org/source/rpc_server/srv_spoolss_nt.c	Wed Jun 19 10:13:47 2002
+++ samba-2.2.5/source/rpc_server/srv_spoolss_nt.c	Tue Jul 16 13:46:43 2002
@@ -412,7 +412,7 @@
 	DEBUG(4,("Setting printer name=%s (len=%d)\n", handlename, strlen(handlename)));
 
 	if (Printer->printer_type==PRINTER_HANDLE_IS_PRINTSERVER) {
-		ZERO_STRUCT(Printer->dev.printerservername);
+		ZERO_ARRAY(Printer->dev.printerservername);
 		strncpy(Printer->dev.printerservername, handlename, strlen(handlename));
 		return True;
 	}
@@ -463,7 +463,7 @@
 	
 	DEBUGADD(4,("set_printer_hnd_name: Printer found: %s -> %s\n", aprinter, sname));
 
-	ZERO_STRUCT(Printer->dev.handlename);
+	ZERO_ARRAY(Printer->dev.handlename);
 	fstrcpy(Printer->dev.handlename, sname);
 
 	return True;
@@ -4196,10 +4196,10 @@
 static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername)
 {
 	pstring temp;
-	fstring nullstr;
+	fstring nullstr[1];
 
 	ZERO_STRUCTP(info);
-	memset(&nullstr, '\0', sizeof(fstring));
+	memset(nullstr[0], '\0', sizeof(fstring));
 
 	info->version=driver.info_3->cversion;
 
@@ -4237,7 +4237,7 @@
 	init_unistr_array(&info->dependentfiles, driver.info_3->dependentfiles, servername);
 
 	info->previousdrivernames=NULL;
-	init_unistr_array(&info->previousdrivernames, &nullstr, servername);
+	init_unistr_array(&info->previousdrivernames, nullstr, servername);
 
 	info->driver_date.low=0;
 	info->driver_date.high=0;
@@ -8033,8 +8033,10 @@
 	case 1:
 		result = getprintprocessordirectory_level_1
 		  (&q_u->name, &q_u->environment, buffer, offered, needed);
+		break;
 	default:
 		result = WERR_UNKNOWN_LEVEL;
+		break;
 	}
 
 	return result;
diff -uNr samba-2.2.5.org/source/script/installcp.sh samba-2.2.5/source/script/installcp.sh
--- samba-2.2.5.org/source/script/installcp.sh	Mon Dec 13 22:27:43 1999
+++ samba-2.2.5/source/script/installcp.sh	Tue Jul 16 13:46:43 2002
@@ -12,7 +12,7 @@
 echo Installing codepage files in $CODEPAGEDIR
 for d in $LIBDIR $CODEPAGEDIR; do
 if [ ! -d $d ]; then
-mkdir $d
+  $srcdir/script/mkinstalldirs $d
 if [ ! -d $d ]; then
   echo Failed to make directory $d
   exit 1
diff -uNr samba-2.2.5.org/source/script/mkproto.awk samba-2.2.5/source/script/mkproto.awk
--- samba-2.2.5.org/source/script/mkproto.awk	Fri May  3 10:03:45 2002
+++ samba-2.2.5/source/script/mkproto.awk	Tue Jul 16 13:46:43 2002
@@ -8,12 +8,13 @@
 
   print "#ifndef",headername
   print "#define",headername
-  print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */"
+  target=tolower(substr(headername,2,length(headername)-4));
+  printf "/* This file is automatically generated with \"make %s\". DO NOT EDIT */", target;
   print ""
 }
 
 END {
-  print "#endif /* _PROTO_H_ */"
+  print "#endif /*",headername,"*/"
 }
 
 {
diff -uNr samba-2.2.5.org/source/smbd/dosmode.c samba-2.2.5/source/smbd/dosmode.c
--- samba-2.2.5.org/source/smbd/dosmode.c	Fri May  3 10:03:47 2002
+++ samba-2.2.5/source/smbd/dosmode.c	Tue Jul 16 13:46:43 2002
@@ -153,7 +153,7 @@
       else
 	p = path;
       
-      if (p[0] == '.' && p[1] != '.' && p[1] != 0)
+      if (p[0] == '.' && (p[1] != '.' || p[2] != 0) && p[1] != 0)
 	result |= aHIDDEN;
     }
 
diff -uNr samba-2.2.5.org/source/smbd/mangle_hash.c samba-2.2.5/source/smbd/mangle_hash.c
--- samba-2.2.5.org/source/smbd/mangle_hash.c	Tue Jun 18 03:36:33 2002
+++ samba-2.2.5/source/smbd/mangle_hash.c	Tue Jul 16 13:46:43 2002
@@ -206,6 +206,12 @@
       if( (0 == strcmp( p, "PT1" ))
        || (0 == strcmp( p, "PT2" ))
        || (0 == strcmp( p, "PT3" ))
+       || (0 == strcmp( p, "PT4" ))
+       || (0 == strcmp( p, "PT5" ))
+       || (0 == strcmp( p, "PT6" ))
+       || (0 == strcmp( p, "PT7" ))
+       || (0 == strcmp( p, "PT8" ))
+       || (0 == strcmp( p, "PT9" ))
         )
         return( True );
       break;
diff -uNr samba-2.2.5.org/source/smbd/mangle_hash2.c samba-2.2.5/source/smbd/mangle_hash2.c
--- samba-2.2.5.org/source/smbd/mangle_hash2.c	Tue Jun 18 03:36:33 2002
+++ samba-2.2.5/source/smbd/mangle_hash2.c	Tue Jul 16 13:46:43 2002
@@ -98,7 +98,8 @@
 /* the list of reserved dos names - all of these are illegal */
 static const char *reserved_names[] = 
 { "AUX", "LOCK$", "CON", "COM1", "COM2", "COM3", "COM4",
-  "LPT1", "LPT2", "LPT3", "NUL", "PRN", NULL };
+  "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
+  "NUL", "PRN", NULL };
 
 /* 
    hash a string of the specified length. The string does not need to be
diff -uNr samba-2.2.5.org/source/smbd/password.c samba-2.2.5/source/smbd/password.c
--- samba-2.2.5.org/source/smbd/password.c	Fri May  3 10:03:48 2002
+++ samba-2.2.5/source/smbd/password.c	Tue Jul 16 13:46:43 2002
@@ -1188,7 +1188,7 @@
 
 static char *mutex_server_name;
 
-static BOOL grab_server_mutex(const char *name)
+static BOOL grab_server_mutex(char *name)
 {
 	mutex_server_name = strdup(name);
 	if (!mutex_server_name) {
@@ -1522,8 +1522,8 @@
 
 		DEBUG(3,("domain_client_validate: User passwords not in encrypted format.\n"));
 		generate_random_buffer( local_challenge, 8, False);
-		SMBencrypt( (uchar *)smb_apasswd, local_challenge, local_lm_response);
-		SMBNTencrypt((uchar *)smb_ntpasswd, local_challenge, local_nt_response);
+		SMBencrypt(smb_apasswd, local_challenge, local_lm_response);
+		SMBNTencrypt(smb_ntpasswd, local_challenge, local_nt_response);
 		smb_apasslen = 24;
 		smb_ntpasslen = 24;
 		smb_apasswd = (char *)local_lm_response;
diff -uNr samba-2.2.5.org/source/smbd/session.c samba-2.2.5/source/smbd/session.c
--- samba-2.2.5.org/source/smbd/session.c	Sun Feb  3 09:46:56 2002
+++ samba-2.2.5/source/smbd/session.c	Tue Jul 16 13:46:43 2002
@@ -157,7 +157,7 @@
 	}
 
 	tdb_unpack(data.dptr, data.dsize, "fffdd",
-		   &sessionid.username, &sessionid.hostname, &sessionid.id_str,
+		   sessionid.username, sessionid.hostname, sessionid.id_str,
 		   &sessionid.id_num, &sessionid.pid);
 
 	safe_free(data.dptr);
diff -uNr samba-2.2.5.org/source/smbd/utmp.c samba-2.2.5/source/smbd/utmp.c
--- samba-2.2.5.org/source/smbd/utmp.c	Sun Feb  3 09:46:57 2002
+++ samba-2.2.5/source/smbd/utmp.c	Tue Jul 16 13:46:43 2002
@@ -299,8 +299,8 @@
 		 *	man page appears not to specify (hints non-NULL)
 		 *	A correspondent suggest at least ut_name should be NULL
 		 */
-		memset((char *)&u->ut_name, '\0', sizeof(u->ut_name));
-		memset((char *)&u->ut_host, '\0', sizeof(u->ut_host));
+		memset((char *)u->ut_name, '\0', sizeof(u->ut_name));
+		memset((char *)u->ut_host, '\0', sizeof(u->ut_host));
 	}
 	/* Stolen from logwtmp function in libutil.
 	 * May be more locking/blocking is needed?
diff -uNr samba-2.2.5.org/source/smbwrapper/wrapped.c samba-2.2.5/source/smbwrapper/wrapped.c
--- samba-2.2.5.org/source/smbwrapper/wrapped.c	Sun Feb  3 09:46:57 2002
+++ samba-2.2.5/source/smbwrapper/wrapped.c	Tue Jul 16 13:46:43 2002
@@ -463,11 +463,13 @@
 
 #ifdef HAVE_UTIMES
 
+#define utimes fake_utimes
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #else
 #include <time.h>
 #endif
+#undef utimes
 
  int utimes(const char *name, const struct timeval *tvp)
 {
diff -uNr samba-2.2.5.org/source/utils/make_printerdef.c samba-2.2.5/source/utils/make_printerdef.c
--- samba-2.2.5.org/source/utils/make_printerdef.c	Wed Jun 19 10:13:49 2002
+++ samba-2.2.5/source/utils/make_printerdef.c	Tue Jul 16 13:46:43 2002
@@ -182,24 +182,19 @@
 	if (*temp=='[') {
 		found=2;
 		*sbuffer[pointeur]='\0';
+		pointeur++;
 	}
 	else {
 		pstrcpy(sbuffer[pointeur],temp);
 		i=strlen(sbuffer[pointeur])-1;
 		while (sbuffer[pointeur][i]=='\r' || sbuffer[pointeur][i]=='\n')
 			sbuffer[pointeur][i--]='\0';
-		pointeur++;
+		if (i >= 0) pointeur++;
 	}  
   }
 
-  /* CCMRCF Mod, seg fault or worse if not found */
-  if (pointeur == 0) {
-     fprintf(stderr,"Printer not found\tNo [Strings] block in inf file\n");
-     exit(2);
-  }
-
 #ifdef DEBUGIT
-  fprintf(stderr,"\t\tFound %d entries\n",pointeur-1);
+  fprintf(stderr,"\t\tFound %d entries\n",pointeur);
 #endif
 }
 
@@ -254,11 +249,11 @@
 		i=strlen(buffer[pointeur])-1;
 		while (buffer[pointeur][i]=='\r' || buffer[pointeur][i]=='\n')
 			buffer[pointeur][i--]='\0';
-		pointeur++;
+		if (i >= 0) pointeur++;
 	}  
   }
 #ifdef DEBUGIT
-  fprintf(stderr,"\t\tFound %d entries\n",pointeur-1);
+  fprintf(stderr,"\t\tFound %d entries\n",pointeur);
 #endif
 }
 
diff -uNr samba-2.2.5.org/source/utils/smbpasswd.c samba-2.2.5/source/utils/smbpasswd.c
--- samba-2.2.5.org/source/utils/smbpasswd.c	Wed Jun 19 10:13:49 2002
+++ samba-2.2.5/source/utils/smbpasswd.c	Tue Jul 16 13:46:43 2002
@@ -94,7 +94,7 @@
 #endif
 	printf("  -x                   delete user\n");
 	printf("  -j DOMAIN            join domain name\n");
-	printf("  -S DOMAIN            Retrieve the domain SID for DOMAIN\n");
+	printf("  -S                   Retrieve the domain SID for DOMAIN\n");
 	printf("  -R ORDER             name resolve order\n");
 
 	exit(1);
diff -uNr samba-2.2.5.org/source/utils/torture.c samba-2.2.5/source/utils/torture.c
--- samba-2.2.5.org/source/utils/torture.c	Fri May  3 10:03:54 2002
+++ samba-2.2.5/source/utils/torture.c	Tue Jul 16 13:46:43 2002
@@ -1800,14 +1800,14 @@
 				      const char *sub_operation, 
 				      BOOL failure, 
 				      BOOL report,
-				      fstring *buf,
+				      fstring buf,
 				      TABOID *t)
 {
 
-  (*buf)[0] = '\0';
+  buf[0] = '\0';
 
-  snprintf(*buf, 
-	   sizeof(*buf), 
+  snprintf(buf, 
+	   sizeof(buf), 
 	   "%8s[%s]:%10s file %10s user %10s(%5d). share %10s tid %5d owner %10s(%5d). fnum %5d was %5d (%s).", 
 	   operation,
 	   failure?"FAILURE":"SUCCESS",
@@ -1828,7 +1828,7 @@
 	   );
     
   if(report)
-    printf("%s\n", *buf);
+    printf("%s\n", buf);
 
   return True;
 }
@@ -1842,7 +1842,7 @@
 
   fstring buf;
 
-  return run_vusertest_report_full(operation, sub_operation, failure, True, &buf, t);
+  return run_vusertest_report_full(operation, sub_operation, failure, True, buf, t);
 }
 
 static BOOL run_vusertest_report_failure(
@@ -1853,7 +1853,7 @@
 
   fstring buf;
 
-  return run_vusertest_report_full(operation, sub_operation, True, True, &buf, t);
+  return run_vusertest_report_full(operation, sub_operation, True, True, buf, t);
 }
 
 static BOOL run_vusertest_report_success(
@@ -1864,7 +1864,7 @@
 
   fstring buf;
 
-  return run_vusertest_report_full(operation, sub_operation, False, True, &buf, t);
+  return run_vusertest_report_full(operation, sub_operation, False, True, buf, t);
 }
 
 static BOOL run_vusertest_op_init(TABOID *t)
@@ -1939,7 +1939,7 @@
       
   vusers[t->as_user].cli.cnum = vusers[t->owner].per_tid[t->share].tid;
 
-  run_vusertest_report_full("WRITE", "write 2", False, False, &msg, t);
+  run_vusertest_report_full("WRITE", "write 2", False, False, msg, t);
       
   msglen = strlen(msg)+1;
 


More information about the samba-technical mailing list