summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
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/lib/util.c
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/lib/util.c')
-rw-r--r--source3/lib/util.c37
1 files changed, 28 insertions, 9 deletions
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;
}