summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian/patches/samba.patch
blob: be251861cb10327f0e822cf236af83688cc38811 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
--- 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;