summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-02-12 15:52:57 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-02-12 15:52:57 +0000
commit533e25774afe3e752f9d9809e0af22c15b3ca487 (patch)
treeac32d0fc80268a9d7945deffd6122f9f9639d205
parent6542ebbc5196bd90482add8109ea70a48cac451e (diff)
downloaddropbear-533e25774afe3e752f9d9809e0af22c15b3ca487.tar.gz
Allow configuring "allow blank password option" at runtime
Changes this from a compile-time switch to a command-line option. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--options.h5
-rw-r--r--runopts.h1
-rw-r--r--svr-auth.c5
-rw-r--r--svr-authpasswd.c1
-rw-r--r--svr-runopts.c5
5 files changed, 9 insertions, 8 deletions
diff --git a/options.h b/options.h
index 6214c1a..9b03cdb 100644
--- a/options.h
+++ b/options.h
@@ -180,11 +180,6 @@ much traffic. */
#define ENABLE_SVR_PUBKEY_OPTIONS
#endif
-/* Define this to allow logging in to accounts that have no password specified.
- * Public key logins are allowed for blank-password accounts regardless of this
- * setting. */
-/* #define ALLOW_BLANK_PASSWORD */
-
#define ENABLE_CLI_PASSWORD_AUTH
#define ENABLE_CLI_PUBKEY_AUTH
#define ENABLE_CLI_INTERACT_AUTH
diff --git a/runopts.h b/runopts.h
index 6d1086b..9cd84d0 100644
--- a/runopts.h
+++ b/runopts.h
@@ -89,6 +89,7 @@ typedef struct svr_runopts {
int noauthpass;
int norootpass;
+ int allowblankpass;
#ifdef ENABLE_SVR_REMOTETCPFWD
int noremotetcp;
diff --git a/svr-auth.c b/svr-auth.c
index ee2b89f..404232e 100644
--- a/svr-auth.c
+++ b/svr-auth.c
@@ -154,8 +154,8 @@ void recv_msg_userauth_request() {
strncmp(methodname, AUTH_METHOD_NONE,
AUTH_METHOD_NONE_LEN) == 0) {
TRACE(("recv_msg_userauth_request: 'none' request"))
-#ifdef ALLOW_BLANK_PASSWORD
- if (!svr_opts.noauthpass
+ if (svr_opts.allowblankpass
+ && !svr_opts.noauthpass
&& !(svr_opts.norootpass && ses.authstate.pw_uid == 0)
&& ses.authstate.pw_passwd[0] == '\0')
{
@@ -167,7 +167,6 @@ void recv_msg_userauth_request() {
goto out;
}
else
-#endif
{
send_msg_userauth_failure(0, 0);
goto out;
diff --git a/svr-authpasswd.c b/svr-authpasswd.c
index c8c83f9..38fccc2 100644
--- a/svr-authpasswd.c
+++ b/svr-authpasswd.c
@@ -29,6 +29,7 @@
#include "buffer.h"
#include "dbutil.h"
#include "auth.h"
+#include "runopts.h"
#ifdef ENABLE_SVR_PASSWORD_AUTH
diff --git a/svr-runopts.c b/svr-runopts.c
index 2e5edc5..1cd39ff 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -63,6 +63,7 @@ static void printhelp(const char * progname) {
#if defined(ENABLE_SVR_PASSWORD_AUTH) || defined(ENABLE_SVR_PAM_AUTH)
"-s Disable password logins\n"
"-g Disable password logins for root\n"
+ "-B Allow blank password logins\n"
#endif
#ifdef ENABLE_SVR_LOCALTCPFWD
"-j Disable local port forwarding\n"
@@ -115,6 +116,7 @@ void svr_getopts(int argc, char ** argv) {
svr_opts.norootlogin = 0;
svr_opts.noauthpass = 0;
svr_opts.norootpass = 0;
+ svr_opts.allowblankpass = 0;
svr_opts.inetdmode = 0;
svr_opts.portcount = 0;
svr_opts.hostkey = NULL;
@@ -234,6 +236,9 @@ void svr_getopts(int argc, char ** argv) {
case 'g':
svr_opts.norootpass = 1;
break;
+ case 'B':
+ svr_opts.allowblankpass = 1;
+ break;
#endif
case 'h':
printhelp(argv[0]);