summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-08-16 13:03:26 +0000
committerAndrew Tridgell <tridge@samba.org>1996-08-16 13:03:26 +0000
commitf63d4c830aa88d20ababe4c3543bff7becc3a506 (patch)
tree286125d72593631440f3b92c85dac62b3ec2e42f /source3/param
parentb990567a8c8afe8a085eb7865c7704925334a4b5 (diff)
downloadsamba-f63d4c830aa88d20ababe4c3543bff7becc3a506.tar.gz
samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.tar.bz2
samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.zip
- added the "remote announce" option
- made the lp_string() code able to handle any length string - got rid of the obsolete lmhosts code, instead users should use "interfaces" and "remote announce". lmhosts now is just used as a IP to netbios name map - cleanup the inet_address() code (This used to be commit be2b67940302b2e63890cb865fe3948c2206ea91)
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 7877f2eb99..d0df198a67 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -129,6 +129,7 @@ typedef struct
char *szSmbrun;
char *szWINSserver;
char *szInterfaces;
+ char *szRemoteAnnounce;
int max_log_size;
int mangled_stack;
int max_xmit;
@@ -397,6 +398,7 @@ struct parm_struct
{"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL},
{"character set", P_STRING, P_GLOBAL, &Globals.szCharacterSet, handle_character_set},
{"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL},
+ {"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL},
{"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL},
{"mangled stack", P_INTEGER, P_GLOBAL, &Globals.mangled_stack, NULL},
{"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL},
@@ -637,24 +639,49 @@ static void init_locals(void)
}
-/*******************************************************************
-a convenience rooutine to grab string parameters into a rotating
-static buffer, and run standard_sub_basic on them. The buffers
-can be written to by callers
+/******************************************************************* a
+convenience routine to grab string parameters into a rotating buffer,
+and run standard_sub_basic on them. The buffers can be written to by
+callers without affecting the source string.
********************************************************************/
char *lp_string(char *s)
{
- static pstring bufs[10];
- static int next=0;
+ static char *bufs[10];
+ static int buflen[10];
+ static int next = -1;
char *ret;
-
+ int i;
+ int len = s?strlen(s):0;
+
+ if (next == -1) {
+ /* initialisation */
+ for (i=0;i<10;i++) {
+ bufs[i] = NULL;
+ buflen[i] = 0;
+ }
+ next = 0;
+ }
+
+ len = MAX(len+100,sizeof(pstring)); /* the +100 is for some
+ substitution room */
+
+ if (buflen[next] != len) {
+ buflen[next] = len;
+ if (bufs[next]) free(bufs[next]);
+ bufs[next] = (char *)malloc(len);
+ if (!bufs[next]) {
+ DEBUG(0,("out of memory in lp_string()"));
+ exit(1);
+ }
+ }
+
ret = &bufs[next][0];
next = (next+1)%10;
if (!s)
*ret = 0;
else
- StrnCpy(ret,s,sizeof(pstring)-1);
+ StrCpy(ret,s);
standard_sub_basic(ret);
return(ret);
@@ -705,6 +732,7 @@ FN_GLOBAL_STRING(lp_domain_controller,&Globals.szDomainController)
FN_GLOBAL_STRING(lp_username_map,&Globals.szUsernameMap)
FN_GLOBAL_STRING(lp_character_set,&Globals.szCharacterSet)
FN_GLOBAL_STRING(lp_logon_script,&Globals.szLogonScript)
+FN_GLOBAL_STRING(lp_remote_announce,&Globals.szRemoteAnnounce)
FN_GLOBAL_STRING(lp_wins_server,&Globals.szWINSserver)
FN_GLOBAL_STRING(lp_interfaces,&Globals.szInterfaces)