summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-17 10:31:44 +0200
committerGünther Deschner <gd@samba.org>2008-06-17 10:49:38 +0200
commit4500f1d5844ed743ce6d209cd45815ef2b547fab (patch)
treebe55b1c357582cabdadcad964369da8c61ab6fc6 /source3
parent45bce6e50597c32265321ae608c5564ccab10382 (diff)
downloadsamba-4500f1d5844ed743ce6d209cd45815ef2b547fab.tar.gz
samba-4500f1d5844ed743ce6d209cd45815ef2b547fab.tar.bz2
samba-4500f1d5844ed743ce6d209cd45815ef2b547fab.zip
netapi: Fix Bug #5545 (libnetapi_init without $USER)
Based on patch from Erik van Pienbroek. Guenther (This used to be commit 71f4cf773022525ba617f09c495dbff97f8eb2d5)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/netapi/netapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 944c2c9304..cf1be00849 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -85,10 +85,14 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
setenv(KRB5_ENV_CCNAME, ctx->krb5_cc_env, 1);
}
- ctx->username = talloc_strdup(frame, getenv("USER"));
+ if (getenv("USER")) {
+ ctx->username = talloc_strdup(frame, getenv("USER"));
+ } else {
+ ctx->username = talloc_strdup(frame, "");
+ }
if (!ctx->username) {
TALLOC_FREE(frame);
- fprintf(stderr, "out of memory\n");
+ fprintf(stderr, "libnetapi_init: out of memory\n");
return W_ERROR_V(WERR_NOMEM);
}