forked from samba-team/samba
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s3:utils: add new 'net ads setspn list' subcommand
This patch adds basic functionality not unlike the setspn.exe command that is provided by windows for adminsistering SPN on the AD. (see https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc731241(v=ws.11) Only the basic list operation (that corresponds to the -l switch for setspn.exe is implemented) Usage: net ads setspn list <computer> Note: <computer> is optional, if not specified the computer account associated with value returned by lp_netbios_name() is used instead. Signed-off-by: Noel Power <[email protected]> Reviewed-by: Jeremy Allison <[email protected]> Reviewed-by: Andreas Schneider <[email protected]>
- Loading branch information
1 parent
1400ab7
commit 65ef044
Showing
5 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Unix SMB/CIFS implementation. | ||
net ads setspn routines | ||
Copyright (C) Noel Power 2018 | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "includes.h" | ||
#include "ads.h" | ||
|
||
#ifdef HAVE_ADS | ||
bool ads_setspn_list(ADS_STRUCT *ads, const char *machine_name) | ||
{ | ||
size_t i = 0; | ||
TALLOC_CTX *frame = NULL; | ||
char **spn_array = NULL; | ||
size_t num_spns = 0; | ||
bool ok = false; | ||
ADS_STATUS status; | ||
|
||
frame = talloc_stackframe(); | ||
status = ads_get_service_principal_names(frame, | ||
ads, | ||
machine_name, | ||
&spn_array, | ||
&num_spns); | ||
if (!ADS_ERR_OK(status)) { | ||
goto done; | ||
} | ||
|
||
d_printf("Registered SPNs for %s\n", machine_name); | ||
for (i = 0; i < num_spns; i++) { | ||
d_printf("\t%s\n", spn_array[i]); | ||
} | ||
|
||
ok = true; | ||
done: | ||
TALLOC_FREE(frame); | ||
return ok; | ||
} | ||
|
||
#endif /* HAVE_ADS */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters