--- samba-2.2.2.cvs20020120.orig/source/client/smbmount.c
+++ samba-2.2.2.cvs20020120/source/client/smbmount.c
@@ -719,7 +719,7 @@
 					*lp = 0;
 					pstrcpy(password,lp+1);
 					got_pass = True;
-					memset(strchr(opteq+1,'%')+1,'X',strlen(password));
+					memset(strchr(opteq+1,'%')+1,'\0',strlen(password));
 				}
 				if ((lp=strchr(username,'/'))) {
 					*lp = 0;
@@ -729,7 +729,7 @@
 				  !strcmp(opts, "password")) {
 				pstrcpy(password,opteq+1);
 				got_pass = True;
-				memset(opteq+1,'X',strlen(password));
+				memset(opteq+1,'\0',strlen(password));
 			} else if(!strcmp(opts, "credentials")) {
 				pstrcpy(credentials,opteq+1);
 			} else if(!strcmp(opts, "netbiosname")) {
@@ -822,7 +822,7 @@
 			*p = 0;
 			pstrcpy(password,p+1);
 			got_pass = True;
-			memset(strchr(getenv("USER"),'%')+1,'X',strlen(password));
+			memset(strchr(getenv("USER"),'%')+1,'\0',strlen(password));
 		}
 		strupper(username);
 	}
--- samba-2.2.2.cvs20020120.orig/source/script/installbin.sh
+++ samba-2.2.2.cvs20020120/source/script/installbin.sh
@@ -11,7 +11,7 @@
 shift
 shift
 
-for d in $BASEDIR $BINDIR $LIBDIR $VARDIR $BASEDIR/private; do
+for d in $BASEDIR $BINDIR $LIBDIR $VARDIR; do
 if [ ! -d $d ]; then
 mkdir $d
 if [ ! -d $d ]; then
@@ -33,9 +33,11 @@
  chmod $INSTALLPERMS $BINDIR/$p2
 
  # this is a special case, mount needs this in a specific location
- if [ $p2 = smbmount ]; then
-   ln -sf $BINDIR/$p2 /sbin/mount.smbfs
- fi
+# Commented out for the Debian Samba package. We take care of this
+#	important symlink in debian/rules. (peloy@debian.org)
+# if [ $p2 = smbmount ]; then
+#   ln -sf $BINDIR/$p2 /sbin/mount.smbfs
+# fi
 done
 
 
--- samba-2.2.2.cvs20020120.orig/source/script/installswat.sh
+++ samba-2.2.2.cvs20020120/source/script/installswat.sh
@@ -48,8 +48,8 @@
 for f in $SRCDIR../docs/htmldocs/*.html; do
       FNAME=$SWATDIR/help/`basename $f`
       echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
+      ln -s ../../../../doc/samba-doc/htmldocs/`basename $f` $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
+#      chmod 0644 $FNAME
 done
 
 # Install "server-side" includes
@@ -63,7 +63,10 @@
 
 # Install Using Samba book
 
-if [ "x$BOOKDIR" != "x" ]; then
+# For Debian we do not install anything here, we just create a symlink
+#	pointing to /usr/share/doc/samba-doc/htmldocs/using_samba/ in
+#	debian/rules (peloy@debian.org)
+if /bin/false; then
 
     # Create directories
 
--- samba-2.2.2.cvs20020120.orig/source/web/diagnose.c
+++ samba-2.2.2.cvs20020120/source/web/diagnose.c
@@ -54,6 +54,7 @@
 	static struct cli_state cli;
 	extern struct in_addr loopback_ip;
 
+	loopback_ip.s_addr = htonl((127 << 24) + 1);
 	if (!cli_initialise(&cli))
 		return False;
 
--- samba-2.2.2.cvs20020120.orig/source/web/startstop.c
+++ samba-2.2.2.cvs20020120/source/web/startstop.c
@@ -37,7 +37,7 @@
 		return;
 	}
 
-	slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", SBINDIR);
+	slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", "/usr/sbin");
 
 	become_daemon();
 
@@ -58,7 +58,7 @@
 		return;
 	}
 
-	slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", SBINDIR);
+	slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", "/usr/sbin");
 	
 	become_daemon();
 
--- samba-2.2.2.cvs20020120.orig/source/web/swat.c
+++ samba-2.2.2.cvs20020120/source/web/swat.c
@@ -49,6 +49,19 @@
 #define ENABLE_USER_FLAG "enable_user_flag"
 #define RHOST "remote_host"
 
+typedef struct html_conversion {
+	char src;
+	char *dest;
+} html_conversion;
+
+static const html_conversion entities[] = {
+	{ '"', "&quot;"	},
+	{ '&', "&amp;"	},
+	{ '<', "&lt;"	},
+	{ '>', "&gt;"	},
+	{ '\0', NULL },
+};
+
 /* we need these because we link to locking*.o */
  void become_root(void) {}
  void unbecome_root(void) {}
@@ -77,6 +90,51 @@
 	return newstring;
 }
 
+static char *htmlentities(char *str)
+{
+	int i,j, destlen = 0;
+	int length = strlen(str);
+	/* Feel free to use a pstring if appropriate -- I haven't 
+	   checked if it's guaranteed to be long enough, and suspect it 
+	   isn't. -SRL */
+	char *dststr = NULL;
+	char *p;
+
+	for (i = 0; i < length; i++) {
+		for (j = 0; entities[j].src; j++) {
+			if (str[i] == entities[j].src) {
+				destlen += strlen(entities[j].dest);
+				break;
+			}
+		}
+		if (!entities[j].src) {
+			destlen++;
+		}
+	}
+	if (length == destlen) {
+		return(strdup(str));
+	}
+	p = dststr = malloc(destlen + 1);
+	if (!dststr) {
+		return(NULL);
+	}
+	dststr[destlen] = '\0';
+	for (i = 0; i < length; i++) {
+		for (j = 0; entities[j].src; j++) {
+			if (str[i] == entities[j].src) {
+				strncpy(p, entities[j].dest,
+				        strlen(entities[j].dest));
+				p += strlen(entities[j].dest);
+				break;
+			}
+		}
+		if (!entities[j].src) {
+			*p++ = str[i];
+		}
+	}
+	return(dststr);
+}
+
 static char *stripspace(char *str)
 {
 static char newstring[1024];
@@ -182,8 +240,12 @@
 
 	case P_STRING:
 	case P_USTRING:
-		printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
-		       make_parm_name(parm->label), *(char **)ptr);
+		str = htmlentities(*(char **)ptr);
+		printf("<input type=\"text\" size=\"40\" name=\"parm_%s\" value=\"%s\">",
+		       make_parm_name(parm->label), str);
+		if (str != NULL) {
+			free(str);
+		}
 		printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
 			make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
 		break;
