*/
#include "includes.h"
-#include "popt_common.h"
+#include "auth_info.h"
#include "secrets.h"
/**************************************************************************n
return NULL;
}
- result->signing_state = Undefined;
+ result->signing_state = SMB_SIGNING_DEFAULT;
return result;
}
bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
const char *arg)
{
- auth_info->signing_state = -1;
+ auth_info->signing_state = SMB_SIGNING_DEFAULT;
if (strequal(arg, "off") || strequal(arg, "no") ||
strequal(arg, "false")) {
- auth_info->signing_state = false;
+ auth_info->signing_state = SMB_SIGNING_OFF;
} else if (strequal(arg, "on") || strequal(arg, "yes") ||
+ strequal(arg, "if_required") ||
strequal(arg, "true") || strequal(arg, "auto")) {
- auth_info->signing_state = true;
+ auth_info->signing_state = SMB_SIGNING_IF_REQUIRED;
} else if (strequal(arg, "force") || strequal(arg, "required") ||
strequal(arg, "forced")) {
- auth_info->signing_state = Required;
+ auth_info->signing_state = SMB_SIGNING_REQUIRED;
} else {
return false;
}
return auth_info->use_ccache;
}
+void set_cmdline_auth_info_use_pw_nt_hash(struct user_auth_info *auth_info,
+ bool b)
+{
+ auth_info->use_pw_nt_hash = b;
+}
+
+bool get_cmdline_auth_info_use_pw_nt_hash(
+ const struct user_auth_info *auth_info)
+{
+ return auth_info->use_pw_nt_hash;
+}
+
void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
bool b)
{
return auth_info->use_machine_account;
}
-struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
- const struct user_auth_info *src)
-{
- struct user_auth_info *result;
-
- result = user_auth_info_init(mem_ctx);
- if (result == NULL) {
- return NULL;
- }
-
- *result = *src;
-
- result->username = talloc_strdup(
- result, get_cmdline_auth_info_username(src));
- result->password = talloc_strdup(
- result, get_cmdline_auth_info_password(src));
- if ((result->username == NULL) || (result->password == NULL)) {
- TALLOC_FREE(result);
- return NULL;
- }
-
- return result;
-}
-
bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info)
{
char *pass = NULL;
return false;
}
- if (asprintf(&account, "%s$@%s", global_myname(), lp_realm()) < 0) {
+ if (asprintf(&account, "%s$@%s", lp_netbios_name(), lp_realm()) < 0) {
return false;
}
void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info)
{
char *label = NULL;
- char *pass;
+ char pwd[256] = {0};
+ int rc;
TALLOC_CTX *frame;
if (get_cmdline_auth_info_got_pass(auth_info) ||
frame = talloc_stackframe();
label = talloc_asprintf(frame, "Enter %s's password: ",
get_cmdline_auth_info_username(auth_info));
- pass = getpass(label);
- if (pass) {
- set_cmdline_auth_info_password(auth_info, pass);
+ rc = samba_getpass(label, pwd, sizeof(pwd), false, false);
+ if (rc == 0) {
+ set_cmdline_auth_info_password(auth_info, pwd);
}
TALLOC_FREE(frame);
}