From a8065e3c7f014d686c4d9c52d8b144794ec754d5 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Mon, 8 Jun 2009 21:03:43 +0200 Subject: [PATCH] net: Don't segfault if no username is given to net ads leave Fixes the crash part of bug #6453 Signed-off-by: Kai Blin --- source/utils/net_ads.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c index d0f7430..6e94345 100644 --- a/source/utils/net_ads.c +++ b/source/utils/net_ads.c @@ -874,6 +874,12 @@ static int net_ads_leave(struct net_context *c, int argc, const char **argv) return 0; } + if (c->opt_user_name == NULL) { + d_fprintf(stderr, "No administrator username given. " + "You need to specify a username\n"); + return -1; + } + if (!*lp_realm()) { d_fprintf(stderr, "No realm set, are we joined ?\n"); return -1; -- 1.5.4.3