[PATCH] 2.0.7-pre1, option to dissable sessio_users list.

Mattias.Gronlund Mattias.Gronlund at sa.erisoft.se
Wed Feb 2 22:45:00 GMT 2000


Hi,

In search for nameserver-load generated by SAMBA I found out
that most of the calls where made with getpwnam with usernames
that I do not think will succeed at that many sites at all.

This patch adds a new option to SAMBA "session users" that is
defaulted to True to behave as before. But if it is set to
False the session_users list will not be used. I

Any comments ?

/Mattias
-------------- next part --------------
--- samba-pre2.0.7/docs/yodldocs/smb.conf.5.yo	Sat Jan 29 03:41:33 2000
+++ samba-pre2.0.7-homes/docs/yodldocs/smb.conf.5.yo	Wed Feb  2 23:12:40 2000
@@ -696,6 +696,8 @@
 
 it() link(bf(server string))(serverstring)
 
+it() link(bf(session users))(sessionusers)
+
 it() link(bf(shared mem size))(sharedmemsize)
 
 it() link(bf(smb passwd file))(smbpasswdfile)
@@ -5544,6 +5546,18 @@
 
   bf(Example:)
 tt( 	set directory = yes)
+
+label(sessionusers)
+dit(bf(session users (G)))
+
+This enables or disables the use of a session users list, the list
+is needed by some SMB-clients that calls SMBTconX without a username. 
+
+  bf(Default:)
+tt( 	set directory = True)
+
+  bf(Example:)
+tt( 	set directory = False)
 
 label(sharemodes)
 dit(bf(share modes (S)))
--- samba-pre2.0.7/source/include/proto.h	Wed Jan 26 22:03:35 2000
+++ samba-pre2.0.7-homes/source/include/proto.h	Wed Feb  2 22:28:20 2000
@@ -1107,6 +1107,7 @@
 BOOL lp_stat_cache(void);
 BOOL lp_allow_trusted_domains(void);
 BOOL lp_restrict_anonymous(void);
+BOOL lp_sessio_users(void);
 int lp_os_level(void);
 int lp_max_ttl(void);
 int lp_max_wins_ttl(void);
--- samba-pre2.0.7/source/param/loadparm.c	Sat Jan 29 03:42:57 2000
+++ samba-pre2.0.7-homes/source/param/loadparm.c	Wed Feb  2 22:54:17 2000
@@ -248,6 +248,7 @@
   BOOL bDebugHiresTimestamp;
   BOOL bDebugPid;
   BOOL bDebugUid;
+  BOOL bSessionUsers;
 } global;
 
 static global Globals;
@@ -623,6 +624,7 @@
   {"allow hosts",      P_STRING,  P_LOCAL,  &sDefault.szHostsallow,     NULL,   NULL,  0},
   {"hosts deny",       P_STRING,  P_LOCAL,  &sDefault.szHostsdeny,      NULL,   NULL,  FLAG_GLOBAL|FLAG_BASIC|FLAG_SHARE|FLAG_PRINT},
   {"deny hosts",       P_STRING,  P_LOCAL,  &sDefault.szHostsdeny,      NULL,   NULL,  0},
+  {"session users",    P_BOOL,    P_GLOBAL,  &Globals.bSessionUsers,    NULL,   NULL,  0},
 
 #ifdef WITH_SSL
   {"Secure Socket Layer Options", P_SEP, P_SEPARATOR},
@@ -983,6 +985,7 @@
   Globals.map_to_guest = 0; /* By Default, "Never" */
   Globals.min_passwd_length = MINPASSWDLENGTH; /* By Default, 5. */
   Globals.oplock_break_wait_time = 10; /* By Default, 10 msecs. */
+  Globals.bSessionUsers = True;
 
 #ifdef WITH_LDAP
   /* default values for ldap */
@@ -1278,6 +1281,7 @@
 FN_GLOBAL_BOOL(lp_stat_cache,&Globals.bStatCache)
 FN_GLOBAL_BOOL(lp_allow_trusted_domains,&Globals.bAllowTrustedDomains)
 FN_GLOBAL_BOOL(lp_restrict_anonymous,&Globals.bRestrictAnonymous)
+FN_GLOBAL_BOOL(lp_session_users,&Globals.bSessionUsers)
 
 FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
 FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
--- samba-pre2.0.7/source/smbd/password.c	Fri Jan  7 23:00:43 2000
+++ samba-pre2.0.7-homes/source/smbd/password.c	Wed Feb  2 23:08:25 2000
@@ -293,12 +293,15 @@
 void add_session_user(char *user)
 {
   fstring suser;
-  StrnCpy(suser,user,sizeof(suser)-1);
 
-  if (!Get_Pwnam(suser,True)) return;
+  if (!lp_session_users()) return;
+
+  StrnCpy(suser,user,sizeof(suser)-1);
 
   if (suser && *suser && !in_list(suser,session_users,False))
     {
+      if (!Get_Pwnam(suser,True)) return;
+
       if (strlen(suser) + strlen(session_users) + 2 >= sizeof(pstring))
 	DEBUG(1,("Too many session users??\n"));
       else
@@ -731,7 +734,7 @@
 
 
       /* now check the list of session users */
-    if (!ok)
+    if ((!ok) && lp_session_users())
     {
       char *auser;
       char *user_list = strdup(session_users);


More information about the samba-technical mailing list