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);
+ }
+
libnetapi_initialized = true;
*context = stat_ctx = ctx;
const char *username)
{
TALLOC_FREE(ctx->username);
- ctx->username = talloc_strdup(ctx, username);
+ ctx->username = talloc_strdup(ctx, username ? username : "");
+
if (!ctx->username) {
return W_ERROR_V(WERR_NOMEM);
}