summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/chgpasswd.c4
-rw-r--r--source3/smbd/lanman.c2
-rw-r--r--source3/smbd/mangle_hash2.c57
-rw-r--r--source3/smbd/password.c2
4 files changed, 20 insertions, 45 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index a5274862fc..9e593b022e 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -707,11 +707,11 @@ BOOL change_lanman_password(SAM_ACCOUNT *sampass, uchar * pass1,
D_P16(pwd, pass2, unenc_new_pw);
}
- if (!pdb_set_lanman_passwd(sampass, unenc_new_pw, PDB_CHANGED)) {
+ if (!pdb_set_lanman_passwd(sampass, unenc_new_pw)) {
return False;
}
- if (!pdb_set_nt_passwd (sampass, NULL, PDB_CHANGED)) {
+ if (!pdb_set_nt_passwd (sampass, NULL)) {
return False; /* We lose the NT hash. Sorry. */
}
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 3b07eb3a9b..8bfad4ab33 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -72,7 +72,7 @@ static int CopyExpanded(connection_struct *conn,
StrnCpy(buf,src,sizeof(buf)/2);
pstring_sub(buf,"%S",lp_servicename(snum));
standard_sub_conn(conn,buf,sizeof(buf));
- l = push_ascii(*dst,buf,*n, STR_TERMINATE);
+ l = push_ascii(*dst,buf,*n-1, STR_TERMINATE);
(*dst) += l;
(*n) -= l;
return l;
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index bbc9020eab..5adde19eea 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -87,13 +87,6 @@ static unsigned char char_flags[256];
#define FLAG_CHECK(c, flag) (char_flags[(unsigned char)(c)] & (flag))
-/*
- this determines how many characters are used from the original filename
- in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
- The largest possible value is 6.
-*/
-static unsigned mangle_prefix;
-
/* we will use a very simple direct mapped prefix cache. The big
advantage of this cache structure is speed and low memory usage
@@ -224,18 +217,16 @@ static BOOL is_mangled_component(const char *name)
}
}
- /* check lead characters */
- for (i=0;i<mangle_prefix;i++) {
- if (! FLAG_CHECK(name[i], FLAG_ASCII)) {
- return False;
- }
+ /* check first character */
+ if (! FLAG_CHECK(name[0], FLAG_ASCII)) {
+ return False;
}
/* check rest of hash */
if (! FLAG_CHECK(name[7], FLAG_BASECHAR)) {
return False;
}
- for (i=mangle_prefix;i<6;i++) {
+ for (i=1;i<6;i++) {
if (! FLAG_CHECK(name[i], FLAG_BASECHAR)) {
return False;
}
@@ -380,7 +371,7 @@ static BOOL check_cache(char *name)
/* we need to extract the hash from the 8.3 name */
hash = base_reverse[(unsigned char)name[7]];
- for (multiplier=36, i=5;i>=mangle_prefix;i--) {
+ for (multiplier=36, i=5;i>=1;i--) {
u32 v = base_reverse[(unsigned char)name[i]];
hash += multiplier * v;
multiplier *= 36;
@@ -487,7 +478,7 @@ static BOOL is_legal_name(const char *name)
static void name_map(char *name, BOOL need83, BOOL cache83)
{
char *dot_p;
- char lead_chars[7];
+ char lead_char;
char extension[4];
int extension_length, i;
int prefix_len;
@@ -525,20 +516,15 @@ static void name_map(char *name, BOOL need83, BOOL cache83)
if (i == 0 || i == 4) dot_p = NULL;
}
- /* the leading characters in the mangled name is taken from
- the first characters of the name, if they are ascii otherwise
- '_' is used
+ /* the leading character in the mangled name is taken from
+ the first character of the name, if it is ascii
+ otherwise '_' is used
*/
- for (i=0;i<mangle_prefix && name[i];i++) {
- lead_chars[i] = name[i];
- if (! FLAG_CHECK(lead_chars[i], FLAG_ASCII)) {
- lead_chars[i] = '_';
- }
- lead_chars[i] = toupper(lead_chars[i]);
- }
- for (;i<mangle_prefix;i++) {
- lead_chars[i] = '_';
+ lead_char = name[0];
+ if (! FLAG_CHECK(lead_char, FLAG_ASCII)) {
+ lead_char = '_';
}
+ lead_char = toupper(lead_char);
/* the prefix is anything up to the first dot */
if (dot_p) {
@@ -563,12 +549,10 @@ static void name_map(char *name, BOOL need83, BOOL cache83)
v = hash = mangle_hash(name, prefix_len);
/* now form the mangled name. */
- for (i=0;i<mangle_prefix;i++) {
- new_name[i] = lead_chars[i];
- }
+ new_name[0] = lead_char;
new_name[7] = base_forward(v % 36);
new_name[6] = '~';
- for (i=5; i>=mangle_prefix; i--) {
+ for (i=5; i>=1; i--) {
v = v / 36;
new_name[i] = base_forward(v % 36);
}
@@ -610,7 +594,7 @@ static void init_tables(void)
memset(char_flags, 0, sizeof(char_flags));
- for (i=1;i<128;i++) {
+ for (i=0;i<128;i++) {
if ((i >= '0' && i <= '9') ||
(i >= 'a' && i <= 'z') ||
(i >= 'A' && i <= 'Z')) {
@@ -672,15 +656,6 @@ static struct mangle_fns mangle_fns = {
/* return the methods for this mangling implementation */
struct mangle_fns *mangle_hash2_init(void)
{
- /* the mangle prefix can only be in the mange 1 to 6 */
- mangle_prefix = lp_mangle_prefix();
- if (mangle_prefix > 6) {
- mangle_prefix = 6;
- }
- if (mangle_prefix < 1) {
- mangle_prefix = 1;
- }
-
init_tables();
mangle_reset();
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 1e87065e31..f2956237dd 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -134,7 +134,7 @@ int register_vuid(auth_serversupplied_info *server_info, const char *smb_name)
* the new real sam db won't have reference to unix uids or gids
*/
if (!IS_SAM_UNIX_USER(server_info->sam_account)) {
- DEBUG(0,("Attempted session setup with invalid user. No uid/gid in SAM_ACCOUNT\n"));
+ DEBUG(0,("Attempted session setup with invalid user. No uid/gid in SAM_ACCOUNT (flags:%x)\n", pdb_get_init_flag(server_info->sam_account)));
free(vuser);
return UID_FIELD_INVALID;
}