summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-06-06 16:14:17 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-06-06 16:14:17 +0000
commit548196362bf5f81de823a075e86bb9ac10e6b14b (patch)
tree521c4c6b00a0f19ba3c8248a9648b5e92b4c2436 /source3
parent3f067df49514c821eec5e9be132e6bd42c268506 (diff)
downloadsamba-548196362bf5f81de823a075e86bb9ac10e6b14b.tar.gz
samba-548196362bf5f81de823a075e86bb9ac10e6b14b.tar.bz2
samba-548196362bf5f81de823a075e86bb9ac10e6b14b.zip
loadparm.c: Made explicit max packet now ignored.
namedbwork.c: Don't announce potential browser if local master = False. nameelect.c: Raise debug level of comment to 2. proto.h: Added reset_globals_after_fork(). server.c: Call reset_globals_after_fork() after forking child. util.c: Added reset_globals_after_fork() - should stop problems with % substitutions in children. (This used to be commit 77be0f710cc96441d966ab7b026a0d591b01ffb0)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/util.c37
-rw-r--r--source3/namedbwork.c3
-rw-r--r--source3/nameelect.c2
-rw-r--r--source3/param/loadparm.c2
-rw-r--r--source3/smbd/server.c8
6 files changed, 40 insertions, 13 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2b30b7174e..66e626487e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -929,6 +929,7 @@ int interpret_security(char *str,int def);
uint32 interpret_addr(char *str);
struct in_addr *interpret_addr2(char *str);
BOOL zero_ip(struct in_addr ip);
+void reset_globals_after_fork();
char *client_name(void);
char *client_addr(void);
void standard_sub_basic(char *s);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 831d7d64e0..610f9f46a5 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3036,7 +3036,9 @@ BOOL zero_ip(struct in_addr ip)
}
-/* matchname - determine if host name matches IP address */
+/*******************************************************************
+ matchname - determine if host name matches IP address
+ ******************************************************************/
static BOOL matchname(char *remotehost,struct in_addr addr)
{
struct hostent *hp;
@@ -3079,7 +3081,24 @@ static BOOL matchname(char *remotehost,struct in_addr addr)
return False;
}
-/* return the DNS name of the client */
+/*******************************************************************
+ Reset the 'done' variables so after a client process is created
+ from a fork call these calls will be re-done. This should be
+ expanded if more variables need reseting.
+ ******************************************************************/
+
+static BOOL global_client_name_done = False;
+static BOOL global_client_addr_done = False;
+
+void reset_globals_after_fork()
+{
+ global_client_name_done = False;
+ global_client_addr_done = False;
+}
+
+/*******************************************************************
+ return the DNS name of the client
+ ******************************************************************/
char *client_name(void)
{
extern int Client;
@@ -3087,10 +3106,9 @@ char *client_name(void)
struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
int length = sizeof(sa);
static pstring name_buf;
- static BOOL done = False;
struct hostent *hp;
- if (done)
+ if (global_client_name_done)
return name_buf;
strcpy(name_buf,"UNKNOWN");
@@ -3113,11 +3131,13 @@ char *client_name(void)
strcpy(name_buf,"UNKNOWN");
}
}
- done = True;
+ global_client_name_done = True;
return name_buf;
}
-/* return the IP addr of the client as a string */
+/*******************************************************************
+ return the IP addr of the client as a string
+ ******************************************************************/
char *client_addr(void)
{
extern int Client;
@@ -3125,9 +3145,8 @@ char *client_addr(void)
struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
int length = sizeof(sa);
static fstring addr_buf;
- static BOOL done = False;
- if (done)
+ if (global_client_addr_done)
return addr_buf;
strcpy(addr_buf,"0.0.0.0");
@@ -3139,7 +3158,7 @@ char *client_addr(void)
strcpy(addr_buf,(char *)inet_ntoa(sockin->sin_addr));
- done = True;
+ global_client_addr_done = True;
return addr_buf;
}
diff --git a/source3/namedbwork.c b/source3/namedbwork.c
index d752916815..a17de731bb 100644
--- a/source3/namedbwork.c
+++ b/source3/namedbwork.c
@@ -88,7 +88,8 @@ static struct work_record *make_workgroup(char *name)
StrnCpy(work->work_group,name,sizeof(work->work_group)-1);
work->serverlist = NULL;
- work->ServerType = DFLT_SERVER_TYPE | SV_TYPE_POTENTIAL_BROWSER;
+ work->ServerType = DFLT_SERVER_TYPE | (lp_local_master() ?
+ SV_TYPE_POTENTIAL_BROWSER : 0 );
work->RunningElection = False;
work->ElectionCount = 0;
work->needelection = False;
diff --git a/source3/nameelect.c b/source3/nameelect.c
index 258ee98931..a53f86dcee 100644
--- a/source3/nameelect.c
+++ b/source3/nameelect.c
@@ -82,7 +82,7 @@ void check_master_browser(time_t t)
becoming a master browser, hence the log message.
*/
- DEBUG(0,("%s potential master for %s %s - force election\n",
+ DEBUG(2,("%s potential master for %s %s - force election\n",
timestring(), work->work_group,
inet_ntoa(d->bcast_ip)));
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index ddd8cc90ba..b368d3b2fa 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -587,7 +587,7 @@ static void init_globals(void)
Globals.bUseRhosts = False;
Globals.max_packet = 65535;
Globals.mangled_stack = 50;
- Globals.max_xmit = Globals.max_packet;
+ Globals.max_xmit = 65535;
Globals.max_mux = 2;
Globals.lpqcachetime = 10;
Globals.pwordlevel = 0;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 51710b7b77..299ae07aa3 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -2065,6 +2065,7 @@ static BOOL open_sockets(BOOL is_daemon,int port)
#else
if (Client != -1 && fork()==0)
{
+ /* Child code ... */
#ifndef NO_SIGNAL_TEST
signal(SIGPIPE, SIGNAL_CAST sig_pipe);
signal(SIGCLD, SIGNAL_CAST SIG_DFL);
@@ -2079,6 +2080,11 @@ static BOOL open_sockets(BOOL is_daemon,int port)
set_socket_options(Client,"SO_KEEPALIVE");
set_socket_options(Client,user_socket_options);
+ /* Reset global variables in util.c so that
+ client substitutions will be done correctly
+ in the process.
+ */
+ reset_globals_after_fork();
return True;
}
close(Client); /* The parent doesn't need this socket */
@@ -3119,7 +3125,7 @@ BOOL yield_connection(int cnum,char *name,int max_connections)
f = fopen(fname,"r+");
if (!f)
{
- DEBUG(2,("Coudn't open lock file %s (%s)\n",fname,strerror(errno)));
+ DEBUG(2,("Couldn't open lock file %s (%s)\n",fname,strerror(errno)));
return(False);
}