summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-02-11 11:07:14 +0000
committerJeremy Allison <jra@samba.org>1998-02-11 11:07:14 +0000
commit99e11e171e40703271ad2a7934708cee66b0bb82 (patch)
treeed892bbc53c3155d43e583ced1a59d47623fa1af /source3/lib/util.c
parent5546e28e69b1a43dbb48e024e233d8ebf7fa667a (diff)
downloadsamba-99e11e171e40703271ad2a7934708cee66b0bb82.tar.gz
samba-99e11e171e40703271ad2a7934708cee66b0bb82.tar.bz2
samba-99e11e171e40703271ad2a7934708cee66b0bb82.zip
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)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c32
1 files changed, 32 insertions, 0 deletions
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 <branko.cibej@hermes.si> */
+ 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;
}