--- source/lib/netapi/netapi.c.orig 2008-06-16 22:52:22.000000000 +0200 +++ source/lib/netapi/netapi.c 2008-06-16 22:57:02.000000000 +0200 @@ -85,11 +85,13 @@ setenv(KRB5_ENV_CCNAME, ctx->krb5_cc_env, 1); } - ctx->username = talloc_strdup(frame, getenv("USER")); - if (!ctx->username) { - TALLOC_FREE(frame); - fprintf(stderr, "out of memory\n"); - return W_ERROR_V(WERR_NOMEM); + if (getenv("USER")) { + ctx->username = talloc_strdup(frame, getenv("USER")); + if (!ctx->username) { + TALLOC_FREE(frame); + fprintf(stderr, "libnetapi_init: out of memory\n"); + return W_ERROR_V(WERR_NOMEM); + } } libnetapi_initialized = true;