summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-06-11 01:03:06 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-06-11 01:03:06 +0000
commit957025bace1bcff34d21a6caeca498e85abccb23 (patch)
tree361b9ec5c43dbe8545f9a3b9423810f67339b072
parent76647c0609773a190055f78486380218d6e080e7 (diff)
downloadsamba-957025bace1bcff34d21a6caeca498e85abccb23.tar.gz
samba-957025bace1bcff34d21a6caeca498e85abccb23.tar.xz
samba-957025bace1bcff34d21a6caeca498e85abccb23.zip
Makefile: Added quoata changes for Linux from Thorvald Natvig
Makefile.RPM: Added quoata changes for Linux from Thorvald Natvig charset.c: Large changes to add multiple client code pages. charset.h: Changed charset_initialise() proto. client.c: Fixed message sending bug. Changed charset_initialise(). ipc.c: Fixed #ifdef compile problems. loadparm.c: Added "client code page" option. nmbd.c: Changed charset_initialise(). Fixed lmhosts read. nmblookup.c: Changed charset_initialise(). proto.h: Added lp_client_code_page(void). quotas.c: Added quoata changes for Linux from Thorvald Natvig reply.c: Changed debug level. Made SMBecho ignore tid. server.c: Changed charset_initialise(). smb.h: Added DEFAULT_CLIENT_CODE_PAGE as 850. smbpasswd.c: Changed charset_initialise(). status.c: Changed charset_initialise(). testparm.c: Changed charset_initialise(). testprns.c: Changed charset_initialise(). Jeremy Allison (jallison@whistle.com)
-rw-r--r--source/Makefile.RPM20
-rw-r--r--source/client/client.c4
-rw-r--r--source/include/charset.h2
-rw-r--r--source/include/proto.h3
-rw-r--r--source/include/smb.h4
-rw-r--r--source/lib/charset.c264
-rw-r--r--source/nmbd/nmbd.c24
-rw-r--r--source/param/loadparm.c4
-rw-r--r--source/smbd/ipc.c4
-rw-r--r--source/smbd/quotas.c94
-rw-r--r--source/smbd/reply.c8
-rw-r--r--source/smbd/server.c4
-rw-r--r--source/utils/nmblookup.c2
-rw-r--r--source/utils/smbpasswd.c2
-rw-r--r--source/utils/status.c2
-rw-r--r--source/utils/testparm.c2
-rw-r--r--source/utils/testprns.c2
17 files changed, 285 insertions, 160 deletions
diff --git a/source/Makefile.RPM b/source/Makefile.RPM
index 83cc38d056d..ca17cce64ef 100644
--- a/source/Makefile.RPM
+++ b/source/Makefile.RPM
@@ -183,16 +183,18 @@ AWK = awk
FLAGSM = -DLINUX
LIBSM =
-# Use this for Linux with shadow passwords and quota
-# contributed by xeno@mix.hive.no
-# Tested on the 1.3.57 kernel and ext2fs filesystem.
-# Notes:
-# /usr/include/sys/quota.h must be a symlink to /usr/include/linux/quota.h
-# The directory quota here must be a symlink to your quota package.
-# I just do 'ln -sf /usr/src/quota-1.50 quota' in this directory to get it to work.
-# FLAGSM = -O3 -m486 -DLINUX -DSHADOW_PWD -DQUOTAS
-# LIBSM = -lshadow
+# Use this for Linux with quotas and without shadow passwords
+# contributed by Andrew.Tridgell@anu.edu.au
+# AXPROC defines DEC Alpha Processor
+# FLAGSM = -DLINUX -DAXPROC -DQUOTAS
+# FLAGSM = -DLINUX -DQUOTAS
+# LIBSM =
+# Use this for Linux with quota and glibc2
+# contributed by xeno@mix.hive.no
+# Tested on the 2.0.30 kernel and ext2fs filesystem.
+# FLAGSM = -DLINUX -DQUOTAS -DNO_ASMSIGNALH -DGLIBC2
+# LIBSM = -L/lib/libc5-compat -lcrypt
# This is for SUNOS5.4 and later (also known as Solaris 2.4 and later)
# contributed by Andrew.Tridgell@anu.edu.au
diff --git a/source/client/client.c b/source/client/client.c
index 32bbbae8cd2..873c88e88c4 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -2921,7 +2921,7 @@ static BOOL send_session_request(char *inbuf,char *outbuf)
/* put in the destination name */
p = outbuf+len;
- name_mangle(dest,p,0x20); /* 0x20 is the SMB server NetBIOS type. */
+ name_mangle(dest,p,name_type); /* 0x20 is the SMB server NetBIOS type. */
len += name_len(p);
/* and my name */
@@ -4316,7 +4316,7 @@ static void usage(char *pname)
setup_logging(pname,True);
TimeInit();
- charset_initialise();
+ charset_initialise(0);
pid = getpid();
uid = getuid();
diff --git a/source/include/charset.h b/source/include/charset.h
index 5f5e2016ee1..25544fb6215 100644
--- a/source/include/charset.h
+++ b/source/include/charset.h
@@ -25,7 +25,7 @@ extern char *dos_char_map;
extern char *upper_char_map;
extern char *lower_char_map;
extern void add_char_string(char *s);
-extern void charset_initialise(void);
+extern void charset_initialise(int);
#ifdef toupper
#undef toupper
diff --git a/source/include/proto.h b/source/include/proto.h
index 66e626487ef..fd4e2dd23c8 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -14,7 +14,7 @@ int interpret_character_set(char *str, int def);
/*The following definitions come from charset.c */
-void charset_initialise(void);
+void charset_initialise(int client_codepage);
void add_char_string(char *s);
/*The following definitions come from chgpasswd.c */
@@ -186,6 +186,7 @@ int lp_printing(void);
int lp_maxdisksize(void);
int lp_lpqcachetime(void);
int lp_syslog(void);
+int lp_client_code_page(void);
char *lp_preexec(int );
char *lp_postexec(int );
char *lp_rootpreexec(int );
diff --git a/source/include/smb.h b/source/include/smb.h
index e0c08183dbe..9af653220a2 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -909,4 +909,8 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
#define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
#endif
+
+/* Default client code page - 850 - Western European */
+#define DEFAULT_CLIENT_CODE_PAGE 850
+
/* _SMB_H */
diff --git a/source/lib/charset.c b/source/lib/charset.c
index 1c396db241d..a83d1133fef 100644
--- a/source/lib/charset.c
+++ b/source/lib/charset.c
@@ -24,6 +24,140 @@
extern int DEBUGLEVEL;
+/*
+ * Codepage definitions.
+ */
+
+/* lower->upper mapping for IBM Code Page 850 - MS-DOS Latin 1 */
+unsigned char cp_850[][4] = {
+/* dec col/row oct hex description */
+/* 133 08/05 205 85 a grave */
+/* 183 11/07 267 B7 A grave */ {0x85,0xB7,1,1},
+/* 160 10/00 240 A0 a acute */
+/* 181 11/05 265 B5 A acute */ {0xA0,0xB5,1,1},
+/* 131 08/03 203 83 a circumflex */
+/* 182 11/06 266 B6 A circumflex */ {0x83,0xB6,1,1},
+/* 198 12/06 306 C6 a tilde */
+/* 199 12/07 307 C7 A tilde */ {0xC6,0xC7,1,1},
+/* 132 08/04 204 84 a diaeresis */
+/* 142 08/14 216 8E A diaeresis */ {0x84,0x8E,1,1},
+/* 134 08/06 206 86 a ring */
+/* 143 08/15 217 8F A ring */ {0x86,0x8F,1,1},
+/* 145 09/01 221 91 ae diphthong */
+/* 146 09/02 222 92 AE diphthong */ {0x91,0x92,1,1},
+/* 135 08/07 207 87 c cedilla */
+/* 128 08/00 200 80 C cedilla */ {0x87,0x80,1,1},
+/* 138 08/10 212 8A e grave */
+/* 212 13/04 324 D4 E grave */ {0x8A,0xD4,1,1},
+/* 130 08/02 202 82 e acute */
+/* 144 09/00 220 90 E acute */ {0x82,0x90,1,1},
+/* 136 08/08 210 88 e circumflex */
+/* 210 13/02 322 D2 E circumflex */ {0x88,0xD2,1,1},
+/* 137 08/09 211 89 e diaeresis */
+/* 211 13/03 323 D3 E diaeresis */ {0x89,0xD3,1,1},
+/* 141 08/13 215 8D i grave */
+/* 222 13/14 336 DE I grave */ {0x8D,0xDE,1,1},
+/* 161 10/01 241 A1 i acute */
+/* 214 13/06 326 D6 I acute */ {0xA1,0xD6,1,1},
+/* 140 08/12 214 8C i circumflex */
+/* 215 13/07 327 D7 I circumflex */ {0x8C,0xD7,1,1},
+/* 139 08/11 213 8B i diaeresis */
+/* 216 13/08 330 D8 I diaeresis */ {0x8B,0xD8,1,1},
+/* 208 13/00 320 D0 Icelandic eth */
+/* 209 13/01 321 D1 Icelandic Eth */ {0xD0,0xD1,1,1},
+/* 164 10/04 244 A4 n tilde */
+/* 165 10/05 245 A5 N tilde */ {0xA4,0xA5,1,1},
+/* 149 09/05 225 95 o grave */
+/* 227 14/03 343 E3 O grave */ {0x95,0xE3,1,1},
+/* 162 10/02 242 A2 o acute */
+/* 224 14/00 340 E0 O acute */ {0xA2,0xE0,1,1},
+/* 147 09/03 223 93 o circumflex */
+/* 226 14/02 342 E2 O circumflex */ {0x93,0xE2,1,1},
+/* 228 14/04 344 E4 o tilde */
+/* 229 14/05 345 E5 O tilde */ {0xE4,0xE5,1,1},
+/* 148 09/04 224 94 o diaeresis */
+/* 153 09/09 231 99 O diaeresis */ {0x94,0x99,1,1},
+/* 155 09/11 233 9B o slash */
+/* 157 09/13 235 9D O slash */ {0x9B,0x9D,1,1},
+/* 151 09/07 227 97 u grave */
+/* 235 14/11 353 EB U grave */ {0x97,0xEB,1,1},
+/* 163 10/03 243 A3 u acute */
+/* 233 14/09 351 E9 U acute */ {0xA3,0xE9,1,1},
+/* 150 09/06 226 96 u circumflex */
+/* 234 14/10 352 EA U circumflex */ {0x96,0xEA,1,1},
+/* 129 08/01 201 81 u diaeresis */
+/* 154 09/10 232 9A U diaeresis */ {0x81,0x9A,1,1},
+/* 236 14/12 354 EC y acute */
+/* 237 14/13 355 ED Y acute */ {0xEC,0xED,1,1},
+/* 231 14/07 347 E7 Icelandic thorn */
+/* 232 14/08 350 E8 Icelandic Thorn */ {0xE7,0xE8,1,1},
+
+ {0x9C,0,0,0}, /* Pound */
+ {0,0,0,0}
+};
+
+/* lower->upper mapping for IBM Code Page 437 - MS-DOS Latin US */
+unsigned char cp_437[][4] = {
+/* 135 08/07 207 87 c cedilla */
+/* 128 08/00 200 80 C cedilla */ {0x87,0x80,1,1},
+/* 129 08/01 201 81 u diaeresis */
+/* 154 09/10 232 9A U diaeresis */ {0x81,0x9A,1,1},
+/* 130 08/02 202 82 e acute */
+/* 144 09/00 220 90 E acute */ {0x82,0x90,1,1},
+/* 131 08/03 203 83 a circumflex */ {0x83,0x41,1,0},
+/* 132 08/04 204 84 a diaeresis */
+/* 142 08/14 216 8E A diaeresis */ {0x84,0x8E,1,1},
+/* 133 08/05 205 85 a grave */ {0x85,0x41,1,0},
+/* 134 08/06 206 86 a ring */ {0x86,0x8F,1,1},
+/* 136 08/08 210 88 e circumflex */ {0x88,0x45,1,0},
+/* 137 08/09 211 89 e diaeresis */ {0x89,0x45,1,0},
+/* 138 08/10 212 8A e grave */ {0x8A,0x45,1,0},
+/* 139 08/11 213 8B i diaeresis */ {0x8B,0x49,1,0},
+/* 140 08/12 214 8C i circumflex */ {0x8C,0x49,1,0},
+/* 141 08/13 215 8D i grave */ {0x8D,0x49,1,0},
+/* 145 09/01 221 91 ae diphthong */
+/* 146 09/02 222 92 AE diphthong */ {0x91,0x92,1,1},
+/* 147 09/03 223 93 o circumflex */ {0x93,0x4F,1,0},
+/* 148 09/04 224 94 o diaeresis */
+/* 153 09/09 231 99 O diaeresis */ {0x94,0x99,1,1},
+/* 149 09/05 225 95 o grave */ {0x95,0x4F,1,0},
+/* 150 09/06 226 96 u circumflex */ {0x96,0x55,1,0},
+/* 151 09/07 227 97 u grave */ {0x97,0x55,1,0},
+/* 152 ??/?? 201 98 u diaeresis */
+ {0x9B,0,0,0}, /* Cent */
+ {0x9C,0,0,0}, /* Pound */
+ {0x9D,0,0,0}, /* Yen */
+/* 160 10/00 240 A0 a acute */ {0xA0,0x41,1,0},
+/* 161 10/01 241 A1 i acute */ {0xA1,0x49,1,0},
+/* 162 10/02 242 A2 o acute */ {0xA2,0x4F,1,0},
+/* 163 10/03 243 A3 u acute */ {0xA3,0x55,1,0},
+/* 164 10/04 244 A4 n tilde */
+/* 165 10/05 245 A5 N tilde */ {0xA4,0xA5,1,1},
+/* Punctuation... */
+ {0xA8,0,0,0},
+ {0xAD,0,0,0},
+ {0xAE,0,0,0},
+ {0xAF,0,0,0},
+/* Greek character set */
+ {0xE0,0,0,0},
+ {0xE1,0,0,0},
+ {0xE2,0,0,0},
+ {0xE3,0,0,0},
+ {0xE4,0,0,0},
+ {0xE5,0,0,0},
+ {0xE6,0,0,0},
+ {0xE7,0,0,0},
+ {0xE8,0,0,0},
+ {0xE9,0,0,0},
+ {0xEA,0,0,0},
+ {0xEB,0,0,0},
+ {0xEC,0,0,0},
+ {0xED,0,0,0},
+ {0xEE,0,0,0},
+ {0xEF,0,0,0},
+ {0,0,0,0}
+};
+
char xx_dos_char_map[256];
char xx_upper_char_map[256];
char xx_lower_char_map[256];
@@ -32,25 +166,42 @@ char *dos_char_map = xx_dos_char_map;
char *upper_char_map = xx_upper_char_map;
char *lower_char_map = xx_lower_char_map;
-static void add_dos_char(int lower, int upper)
+/*
+ * This code has been extended to deal with ascynchronous mappings
+ * like MS-DOS Latin US (Code page 437) where things like :
+ * a acute are capitalized to 'A', but the reverse mapping
+ * must not hold true. This allows the filename case insensitive
+ * matching in do_match() to work, as the DOS/Win95/NT client
+ * uses 'A' as a mask to match against characters like a acute.
+ * This is the meaning behind the parameters that allow a
+ * mapping from lower to upper, but not upper to lower.
+ */
+
+static void add_dos_char(int lower, BOOL map_lower_to_upper,
+ int upper, BOOL map_upper_to_lower)
{
lower &= 0xff;
upper &= 0xff;
- DEBUG(6,("Adding chars 0%o 0%o\n",lower,upper));
+ DEBUG(6,("Adding chars 0x%x 0x%x (l->u = %s) (u->l = %s)\n",lower,upper,
+ map_lower_to_upper ? "True" : "False",
+ map_upper_to_lower ? "True" : "False"));
if (lower) dos_char_map[lower] = 1;
if (upper) dos_char_map[upper] = 1;
if (lower && upper) {
- lower_char_map[upper] = (char)lower;
- upper_char_map[lower] = (char)upper;
+ if(map_upper_to_lower)
+ lower_char_map[upper] = (char)lower;
+ if(map_lower_to_upper)
+ upper_char_map[lower] = (char)upper;
}
}
/****************************************************************************
initialise the charset arrays
****************************************************************************/
-void charset_initialise(void)
+void charset_initialise(int client_codepage)
{
int i;
+ unsigned char (*cp)[4];
#ifdef LC_ALL
/* include <locale.h> in includes.h if available for OS */
@@ -64,7 +215,7 @@ void charset_initialise(void)
for (i=0;i<=127;i++) {
if (isalnum((char)i) || strchr("._^$~!#%&-{}()@'`",(char)i))
- add_dos_char(i,0);
+ add_dos_char(i,0,False,False);
}
for (i=0; i<=255; i++) {
@@ -74,74 +225,37 @@ void charset_initialise(void)
if (islower(c)) upper_char_map[i] = toupper(c);
}
-#define CP850
-#ifdef CP850
-/* lower->upper mapping for IBM Code Page 850 */
+ if(client_codepage != -1)
+ DEBUG(1,("charset_initialise: client code page = %d\n", client_codepage));
-/* dec col/row oct hex description */
-/* 133 08/05 205 85 a grave */
-/* 183 11/07 267 B7 A grave */ add_dos_char(0205,0267);
-/* 160 10/00 240 A0 a acute */
-/* 181 11/05 265 B5 A acute */ add_dos_char(0240,0265);
-/* 131 08/03 203 83 a circumflex */
-/* 182 11/06 266 B6 A circumflex */ add_dos_char(0203,0266);
-/* 198 12/06 306 C6 a tilde */
-/* 199 12/07 307 C7 A tilde */ add_dos_char(0306,0307);
-/* 132 08/04 204 84 a diaeresis */
-/* 142 08/14 216 8E A diaeresis */ add_dos_char(0204,0216);
-/* 134 08/06 206 86 a ring */
-/* 143 08/15 217 8F A ring */ add_dos_char(0206,0217);
-/* 145 09/01 221 91 ae diphthong */
-/* 146 09/02 222 92 AE diphthong */ add_dos_char(0221,0222);
-/* 128 08/00 200 80 C cedilla */
-/* 135 08/07 207 87 c cedilla */ add_dos_char(0207,0200);
-/* 138 08/10 212 8A e grave */
-/* 212 13/04 324 D4 E grave */ add_dos_char(0212,0324);
-/* 130 08/02 202 82 e acute */
-/* 144 09/00 220 90 E acute */ add_dos_char(0202,0220);
-/* 136 08/08 210 88 e circumflex */
-/* 210 13/02 322 D2 E circumflex */ add_dos_char(0210,0322);
-/* 137 08/09 211 89 e diaeresis */
-/* 211 13/03 323 D3 E diaeresis */ add_dos_char(0211,0323);
-/* 141 08/13 215 8D i grave */
-/* 222 13/14 336 DE I grave */ add_dos_char(0215,0336);
-/* 161 10/01 241 A1 i acute */
-/* 214 13/06 326 D6 I acute */ add_dos_char(0241,0326);
-/* 140 08/12 214 8C i circumflex */
-/* 215 13/07 327 D7 I circumflex */ add_dos_char(0214,0327);
-/* 139 08/11 213 8B i diaeresis */
-/* 216 13/08 330 D8 I diaeresis */ add_dos_char(0213,0330);
-/* 208 13/00 320 D0 Icelandic eth */
-/* 209 13/01 321 D1 Icelandic Eth */ add_dos_char(0320,0321);
-/* 164 10/04 244 A4 n tilde */
-/* 165 10/05 245 A5 N tilde */ add_dos_char(0244,0245);
-/* 149 09/05 225 95 o grave */
-/* 227 14/03 343 E3 O grave */ add_dos_char(0225,0343);
-/* 162 10/02 242 A2 o acute */
-/* 224 14/00 340 E0 O acute */ add_dos_char(0242,0340);
-/* 147 09/03 223 93 o circumflex */
-/* 226 14/02 342 E2 O circumflex */ add_dos_char(0223,0342);
-/* 228 14/04 344 E4 o tilde */
-/* 229 14/05 345 E5 O tilde */ add_dos_char(0344,0345);
-/* 148 09/04 224 94 o diaeresis */
-/* 153 09/09 231 99 O diaeresis */ add_dos_char(0224,0231);
-/* 155 09/11 233 9B o slash */
-/* 157 09/13 235 9D O slash */ add_dos_char(0233,0235);
-/* 151 09/07 227 97 u grave */
-/* 235 14/11 353 EB U grave */ add_dos_char(0227,0353);
-/* 163 10/03 243 A3 u acute */
-/* 233 14/09 351 E9 U acute */ add_dos_char(0243,0351);
-/* 150 09/06 226 96 u circumflex */
-/* 234 14/10 352 EA U circumflex */ add_dos_char(0226,0352);
-/* 129 08/01 201 81 u diaeresis */
-/* 154 09/10 232 9A U diaeresis */ add_dos_char(0201,0232);
-/* 236 14/12 354 EC y acute */
-/* 237 14/13 355 ED Y acute */ add_dos_char(0354,0355);
-/* 231 14/07 347 E7 Icelandic thorn */
-/* 232 14/08 350 E8 Icelandic Thorn */ add_dos_char(0347,0350);
-
- add_dos_char(156,0); /* Pound */
-#endif
+ /*
+ * Known client codepages - these can be added to.
+ */
+ switch(client_codepage)
+ {
+ case 850:
+ cp = cp_850;
+ break;
+ case 437:
+ cp = cp_437;
+ break;
+ case -1: /* pre-initialize call so that toupper/tolower work
+ before smb.conf is read. */
+ cp = NULL;
+ break;
+ default:
+ /* Default charset - currently 850 */
+ DEBUG(1,("charset_initialise: Using default client codepage %d\n", 850));
+ cp = cp_850;
+ break;
+
+ }
+
+ if(cp)
+ {
+ for(i = 0; (cp[i][0] != '\0') && (cp[i][1] != '\0'); i++)
+ add_dos_char(cp[i][0], (BOOL)cp[i][2], cp[i][1], (BOOL)cp[i][3]);
+ }
}
/*******************************************************************
@@ -158,10 +272,10 @@ void add_char_string(char *s)
int i1=0,i2=0;
if (isdigit(*t) || (*t)=='-') {
sscanf(t,"%i:%i",&i1,&i2);
- add_dos_char(i1,i2);
+ add_dos_char(i1,True,i2,True);
} else {
sscanf(t,"%c:%c",&c1,&c2);
- add_dos_char(c1,c2);
+ add_dos_char(c1,True,c2, True);
}
}
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index dc3f642cd60..75544535af2 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -421,7 +421,7 @@ static void usage(char *pname)
setup_logging(argv[0],False);
- charset_initialise();
+ charset_initialise(-1);
#ifdef LMHOSTSFILE
strcpy(host_file,LMHOSTSFILE);
@@ -498,12 +498,19 @@ static void usage(char *pname)
if (!reload_services(False))
return(-1);
+ charset_initialise(lp_client_code_page());
+
init_structs();
reload_services(True);
strcpy(myworkgroup, lp_workgroup());
+ if (strequal(myworkgroup,"*")) {
+ DEBUG(0,("ERROR: a workgroup name of * is no longer supported\n"));
+ exit(1);
+ }
+
set_samba_nb_type();
if (!is_daemon && !is_a_socket(0)) {
@@ -546,27 +553,22 @@ static void usage(char *pname)
if (!open_sockets(is_daemon,port)) return 1;
- if (*host_file) {
- load_hosts_file(host_file);
- DEBUG(3,("Loaded hosts file\n"));
- }
-
load_interfaces();
add_my_subnets(myworkgroup);
add_my_names();
- if (strequal(myworkgroup,"*")) {
- DEBUG(0,("ERROR: a workgroup name of * is no longer supported\n"));
- exit(1);
- }
-
DEBUG(3,("Checked names\n"));
load_netbios_names();
DEBUG(3,("Loaded names\n"));
+ if (*host_file) {
+ load_hosts_file(host_file);
+ DEBUG(3,("Loaded hosts file\n"));
+ }
+
write_browse_list(time(NULL));
DEBUG(3,("Dumped names\n"));
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index b368d3b2fa9..b1e2834ca86 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -154,6 +154,7 @@ typedef struct
int ReadSize;
int shmem_size;
int shmem_hash_size;
+ int client_code_page;
BOOL bWINSsupport;
BOOL bWINSproxy;
BOOL bLocalMaster;
@@ -435,6 +436,7 @@ struct parm_struct
#ifdef KANJI
{"coding system", P_INTEGER, P_GLOBAL, &coding_system, handle_coding_system},
#endif /* KANJI */
+ {"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, NULL},
{"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL},
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL},
{"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL},
@@ -618,6 +620,7 @@ static void init_globals(void)
#ifdef KANJI
coding_system = interpret_coding_system (KANJI, SJIS_CODE);
#endif /* KANJI */
+ Globals.client_code_page = DEFAULT_CLIENT_CODE_PAGE;
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base:
@@ -830,6 +833,7 @@ FN_GLOBAL_INTEGER(lp_printing,&Globals.printing)
FN_GLOBAL_INTEGER(lp_maxdisksize,&Globals.maxdisksize)
FN_GLOBAL_INTEGER(lp_lpqcachetime,&Globals.lpqcachetime)
FN_GLOBAL_INTEGER(lp_syslog,&Globals.syslog)
+FN_GLOBAL_INTEGER(lp_client_code_page,&Globals.client_code_page)
FN_LOCAL_STRING(lp_preexec,szPreExec)
FN_LOCAL_STRING(lp_postexec,szPostExec)
diff --git a/source/smbd/ipc.c b/source/smbd/ipc.c
index 8b9fb485ae0..6b3953e6c86 100644
--- a/source/smbd/ipc.c
+++ b/source/smbd/ipc.c
@@ -1964,9 +1964,9 @@ static BOOL api_RNetUserGetInfo(int cnum,uint16 vuid, char *param,char *data,
/* get NIS home of a previously validated user - simeon */
user_struct *vuser = get_valid_user_struct(vuid);
DEBUG(3,(" Username of UID %d is %s\n", vuser->uid, vuser->name));
- #if (defined(NETGROUP) && defined(AUTOMOUNT))
+#if (defined(NETGROUP) && defined(AUTOMOUNT))
DEBUG(3,(" HOMESHR for %s is %s\n", vuser->name, vuser->home_share));
- #endif
+#endif
*rparam_len = 6;
*rparam = REALLOC(*rparam,*rparam_len);
diff --git a/source/smbd/quotas.c b/source/smbd/quotas.c
index eba76d4c74b..a1d29bcd12e 100644
--- a/source/smbd/quotas.c
+++ b/source/smbd/quotas.c
@@ -33,47 +33,43 @@ extern int DEBUGLEVEL;
#ifdef LINUX
-#ifdef __KERNEL__
-# undef __KERNEL__
-# include <sys/quota.h>
-# define __KERNEL__
-#else
-# include <sys/quota.h>
-#endif
+#include <sys/types.h>
+#include <asm/types.h>
+#include <sys/quota.h>
#include <mntent.h>
+#include <linux/unistd.h>
+
+_syscall4(int, quotactl, int, cmd, const char *, special, int, id, caddr_t, addr);
/****************************************************************************
try to get the disk space from disk quotas (LINUX version)
****************************************************************************/
-/*
-If you didn't make the symlink to the quota package, too bad :(
-*/
-#include "quota/quotactl.c"
-#include "quota/hasquota.c"
+
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
{
uid_t euser_id;
+ int r;
+ char dev_disk[256];
struct dqblk D;
struct stat S;
- dev_t devno ;
- struct mntent *mnt;
FILE *fp;
- int found ;
- int qcmd, fd ;
- char *qfpathname;
+ struct mntent *mnt;
+ int devno;
+ int found;
/* find the block device file */
- if ( stat(path, &S) == -1 )
+ if ( stat(path, &S) == -1 ) {
return(False) ;
+ }
devno = S.st_dev ;
fp = setmntent(MOUNTED,"r");
found = False ;
- while ((mnt = getmntent(fp)) != (struct mntent *) 0) {
+ while ((mnt = getmntent(fp))) {
if ( stat(mnt->mnt_dir,&S) == -1 )
continue ;
if (S.st_dev == devno) {
@@ -83,48 +79,42 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
endmntent(fp) ;
- if ( ! found )
- return(False) ;
-
- qcmd = QCMD(Q_GETQUOTA, USRQUOTA);
-
- if (hasmntopt(mnt, MNTOPT_NOAUTO) || hasmntopt(mnt, MNTOPT_NOQUOTA))
- return(False) ;
-
- if (!hasquota(mnt, USRQUOTA, &qfpathname))
- return(False) ;
-
- euser_id = geteuid();
- seteuid(0);
-
- if (quotactl(qcmd, mnt->mnt_fsname, euser_id, (caddr_t)&D) != 0) {
- if ((fd = open(qfpathname, O_RDONLY)) < 0) {
- seteuid(euser_id);
+ if (!found) {
return(False);
}
- lseek(fd, (long) dqoff(euser_id), L_SET);
- switch (read(fd, &D, sizeof(struct dqblk))) {
- case 0:/* EOF */
- memset((caddr_t)&D, 0, sizeof(struct dqblk));
- break;
- case sizeof(struct dqblk): /* OK */
- break;
- default: /* ERROR */
- close(fd);
+
+ euser_id=geteuid();
+ seteuid(0);
+ r=quotactl(QCMD(Q_GETQUOTA,USRQUOTA), mnt->mnt_fsname, euser_id, (caddr_t)&D);
seteuid(euser_id);
- return(False);
+
+ /* Use softlimit to determine disk space, except when it has been exceeded */
+ *bsize = 1024;
+ if (r)
+ {
+ if (errno == EDQUOT)
+ {
+ *dfree =0;
+ *dsize =D.dqb_curblocks;
+ return (True);
}
+ else return(False);
}
- seteuid(euser_id);
- *bsize=1024;
-
- if (D.dqb_bsoftlimit==0)
- return(False);
- if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curinodes>D.dqb_isoftlimit))
+ /* Use softlimit to determine disk space, except when it has been exceeded */
+ if (
+ (D.dqb_bsoftlimit && D.dqb_curblocks>=D.dqb_bsoftlimit) ||
+ (D.dqb_bhardlimit && D.dqb_curblocks>=D.dqb_bhardlimit) ||
+ (D.dqb_isoftlimit && D.dqb_curinodes>=D.dqb_isoftlimit) ||
+ (D.dqb_ihardlimit && D.dqb_curinodes>=D.dqb_ihardlimit)
+ )
{
*dfree = 0;
*dsize = D.dqb_curblocks;
}
+ else if (D.dqb_bsoftlimit==0 && D.dqb_bhardlimit==0)
+ {
+ return(False);
+ }
else {
*dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
*dsize = D.dqb_bsoftlimit;
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 530ce84895f..8af4536c195 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -513,7 +513,7 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
if (!done_sesssetup)
max_send = MIN(max_send,smb_bufsize);
- DEBUG(0,(" Client requested max send size of %d\n", max_send));
+ DEBUG(1,(" Client requested max send size of %d\n", max_send));
done_sesssetup = True;
@@ -2156,11 +2156,17 @@ int reply_echo(char *inbuf,char *outbuf)
cnum = SVAL(inbuf,smb_tid);
+ /* According to the latest CIFS spec we shouldn't
+ care what the TID is.
+ */
+
+#if 0
if (cnum != 0xFFFF && !OPEN_CNUM(cnum))
{
DEBUG(4,("Invalid cnum in echo (%d)\n",cnum));
return(ERROR(ERRSRV,ERRinvnid));
}
+#endif
/* copy any incoming data back out */
if (data_len > 0)
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 299ae07aa30..a44745496b2 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -4036,7 +4036,7 @@ static void usage(char *pname)
setup_logging(argv[0],False);
- charset_initialise();
+ charset_initialise(-1);
/* make absolutely sure we run as root - to handle cases whre people
are crazy enough to have it setuid */
@@ -4151,6 +4151,8 @@ static void usage(char *pname)
if (!reload_services(False))
return(-1);
+ charset_initialise(lp_client_code_page());
+
strcpy(myworkgroup, lp_workgroup());
#ifndef NO_SIGNAL_TEST
diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c
index 582f4eb6db3..68093c10ede 100644
--- a/source/utils/nmblookup.c
+++ b/source/utils/nmblookup.c
@@ -111,7 +111,7 @@ int main(int argc,char *argv[])
setup_logging(argv[0],True);
- charset_initialise();
+ charset_initialise(0);
while ((opt = getopt(argc, argv, "p:d:B:i:s:SMh")) != EOF)
switch (opt)
diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c
index c820ad673a0..495f8e585cb 100644
--- a/source/utils/smbpasswd.c
+++ b/source/utils/smbpasswd.c
@@ -235,7 +235,7 @@ static void usage(char *name)
setup_logging(argv[0],True);
- charset_initialise();
+ charset_initialise(0);
#ifndef DEBUG_PASSWORD
/* Check the effective uid */
diff --git a/source/utils/status.c b/source/utils/status.c
index b439741e6c6..77fbc7fae11 100644
--- a/source/utils/status.c
+++ b/source/utils/status.c
@@ -155,7 +155,7 @@ locking version (was %d, should be %d).\n",fname,
TimeInit();
setup_logging(argv[0],True);
- charset_initialise();
+ charset_initialise(0);
DEBUGLEVEL = 0;
dbf = fopen("/dev/null","w");
diff --git a/source/utils/testparm.c b/source/utils/testparm.c
index 81e69cd76fb..e9a848eb0b4 100644
--- a/source/utils/testparm.c
+++ b/source/utils/testparm.c
@@ -48,7 +48,7 @@ extern int DEBUGLEVEL;
setup_logging(argv[0],True);
- charset_initialise();
+ charset_initialise(0);
if (argc < 2)
strcpy(configfile,CONFIGFILE);
diff --git a/source/utils/testprns.c b/source/utils/testprns.c
index 4a2ddb7c635..c96ad476d29 100644
--- a/source/utils/testprns.c
+++ b/source/utils/testprns.c
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
setup_logging(argv[0],True);
- charset_initialise();
+ charset_initialise(0);
if (argc < 2 || argc > 3)
printf("Usage: testprns printername [printcapfile]\n");