1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-04 05:18:06 +03:00

netapi: Fix Bug #5545 (libnetapi_init without $USER)

Based on patch from Erik van Pienbroek.

Guenther
(This used to be commit 71f4cf7730)
This commit is contained in:
Günther Deschner 2008-06-17 10:31:44 +02:00
parent 45bce6e505
commit 4500f1d584

View File

@ -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);
}