1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:utils: Modify default behaviour of 'net ads keytab add'

This change modifies the behaviour of 'net ads keytab add' such
that only the keytab file is modified.

A new command 'net ads keytab add_update_ads' has been added that
preserves the legacy behaviour which can update the AD computer
object with Winows SPN(s) as appropriate. Alternatively the new
command 'net ads setspn add' can be used to manually add the
windows SPN(s) that previously would have been added.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Noel Power 2018-02-09 14:03:33 +00:00 committed by Andreas Schneider
parent 4e518ecdda
commit 5adb29f242

View File

@ -2605,7 +2605,10 @@ static int net_ads_keytab_flush(struct net_context *c, int argc, const char **ar
return ret;
}
static int net_ads_keytab_add(struct net_context *c, int argc, const char **argv)
static int net_ads_keytab_add(struct net_context *c,
int argc,
const char **argv,
bool update_ads)
{
int i;
int ret = 0;
@ -2626,12 +2629,26 @@ static int net_ads_keytab_add(struct net_context *c, int argc, const char **argv
return -1;
}
for (i = 0; i < argc; i++) {
ret |= ads_keytab_add_entry(ads, argv[i], false);
ret |= ads_keytab_add_entry(ads, argv[i], update_ads);
}
ads_destroy(&ads);
return ret;
}
static int net_ads_keytab_add_default(struct net_context *c,
int argc,
const char **argv)
{
return net_ads_keytab_add(c, argc, argv, false);
}
static int net_ads_keytab_add_update_ads(struct net_context *c,
int argc,
const char **argv)
{
return net_ads_keytab_add(c, argc, argv, true);
}
static int net_ads_keytab_create(struct net_context *c, int argc, const char **argv)
{
ADS_STRUCT *ads;
@ -2680,11 +2697,19 @@ int net_ads_keytab(struct net_context *c, int argc, const char **argv)
struct functable func[] = {
{
"add",
net_ads_keytab_add,
net_ads_keytab_add_default,
NET_TRANSPORT_ADS,
N_("Add a service principal"),
N_("net ads keytab add\n"
" Add a service principal")
" Add a service principal, updates keytab file only.")
},
{
"add_update_ads",
net_ads_keytab_add_update_ads,
NET_TRANSPORT_ADS,
N_("Add a service principal"),
N_("net ads keytab add_update_ads\n"
" Add a service principal, depending on the param passed may update ADS computer object in addition to the keytab file.")
},
{
"create",