From 99e11e171e40703271ad2a7934708cee66b0bb82 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Feb 1998 11:07:14 +0000 Subject: Makefile: Added AIX 3.2.5. loadparm.c: Added "win95 bug compatibility" parameter. local.h: Replaced MAX_OPEN_FILES back to 100 from 10 (oops). reply.c: Fixed ulogoff check against uid - changed to vuid. server.c: Changed file struct save of uid - changed to vuid. smb.h: Changed id in struct current_user to vuid. Changed file struct uid to vuid. time.c: Added "win95 bug compatibility" atime -> mtime return. trans2.c: Added "win95 bug compatibility" fixes. uid.c: Changed id in struct current_user to vuid - added checks to set/reset it. util.c: Added code to expand environment variables. version.h : still at 1.9.18 (head branch doesn't matter too much at present). Jeremy. (This used to be commit adc903bcf59ad1664babd7f1d43675d3a75bfbc9) --- source3/lib/util.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 1d65269f95..3b30f1e6b5 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3811,6 +3811,38 @@ void standard_sub_basic(char *str) case 'h' : string_sub(p,"%h", myhostname); break; case 'm' : string_sub(p,"%m", remote_machine); break; case 'v' : string_sub(p,"%v", VERSION); break; + case '$' : /* Expand environment variables */ + { + /* Contributed by Branko Cibej */ + fstring envname; + char *envval; + char *q, *r; + int copylen; + + if (*(p+2) != '(') { p+=2; break; } + if ((q = strchr(p,')')) == NULL) + { + DEBUG(0,("standard_sub_basic: Unterminated environment \ +variable [%s]\n", p)); + p+=2; break; + } + + r = p+3; + copylen = MIN((q-r),(sizeof(envname)-1)); + strncpy(envname,r,copylen); + envname[copylen] = '\0'; + if ((envval = getenv(envname)) == NULL) + { + DEBUG(0,("standard_sub_basic: Environment variable [%s] not set\n", + envname)); + p+=2; break; + } + copylen = MIN((q+1-p),(sizeof(envname)-1)); + strncpy(envname,p,copylen); + envname[copylen] = '\0'; + string_sub(p,envname,envval); + break; + } case '\0': p++; break; /* don't run off end if last character is % */ default : p+=2; break; } -- cgit