static fstring password[2];
static fstring username[2];
+static int got_user;
static int got_pass;
static BOOL use_kerberos;
static int numops = 1000;
case 'k':
#ifdef HAVE_KRB5
use_kerberos = True;
- got_pass = True;
#else
d_printf("No kerberos support compiled in\n");
exit(1);
#endif
break;
case 'U':
+ got_user = 1;
if (got_pass == 2) {
d_printf("Max of 2 usernames\n");
exit(1);
}
}
+ if(use_kerberos && !got_user) got_pass = True;
+
argc -= optind;
argv += optind;
static char *resultp;
static file_info *f_info;
-void listfn(file_info *f, const char *s, void *state)
+static void listfn(file_info *f, const char *s, void *state)
{
if (strcmp(f->name,".") == 0) {
resultp[0] = '+';
return 0;
}
+static void use_in_memory_ccache(void) {
+ /* Use in-memory credentials cache so we do not interfere with
+ * existing credentials */
+ setenv(KRB5_ENV_CCNAME, "MEMORY:net_ads", 1);
+}
static ADS_STRUCT *ads_startup(void)
{
opt_user_name = "administrator";
}
- if (opt_user_specified)
+ if (opt_user_specified) {
need_password = True;
+ use_in_memory_ccache();
+ }
retry:
if (!opt_password && need_password) {
*/
int net_ads_testjoin(int argc, const char **argv)
{
+ use_in_memory_ccache();
+
/* Display success or failure */
if (net_ads_join_ok() != 0) {
fprintf(stderr,"Join to domain is not valid\n");
(strchr(argv[0], '@') == NULL)) {
return net_ads_usage(argc, argv);
}
-
+
+ use_in_memory_ccache();
c = strchr(auth_principal, '@');
realm = ++c;
opt_password = secrets_fetch_machine_password();
+ use_in_memory_ccache();
+
if (!(ads = ads_startup())) {
return -1;
}