From: Francesco Chemolli Date: Mon, 22 Dec 2014 11:00:30 +0000 (+0100) Subject: Fixed argument parsing and SMB API X-Git-Tag: merge-candidate-3-v1~410^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d7fb18f9c6c0a5f20d032b34f73563fd3a3602d;p=thirdparty%2Fsquid.git Fixed argument parsing and SMB API --- diff --git a/helpers/basic_auth/MSNT/msntauth.cc b/helpers/basic_auth/MSNT/msntauth.cc index 5e09d0596a..69ee0cf6c6 100644 --- a/helpers/basic_auth/MSNT/msntauth.cc +++ b/helpers/basic_auth/MSNT/msntauth.cc @@ -64,7 +64,8 @@ bool validate_user(char *username, char *password) { for (domaincontroller dc : domaincontrollers) { - if (Valid_User(username, password, dc.server.c_str(), dc.domain.c_str())) + int rv = Valid_User(username, password, dc.server.c_str(), dc.domain.c_str()); + if (rv == NTV_NO_ERROR) return true; } return false; @@ -84,7 +85,7 @@ main(int argc, char **argv) for (int j = 1; j < argc; ++j) { std::string arg = argv[j]; size_t pos=arg.find('/'); - if (arg.find('/',pos+1)) { + if (arg.find('/',pos+1) != std::string::npos) { std::cerr << "Error: can't understand domain controller specification '" << arg << '"' << std::endl; exit(1); diff --git a/helpers/basic_auth/MSNT/valid.cc b/helpers/basic_auth/MSNT/valid.cc index 4759681b83..b4659366f0 100644 --- a/helpers/basic_auth/MSNT/valid.cc +++ b/helpers/basic_auth/MSNT/valid.cc @@ -20,7 +20,7 @@ #include "valid.h" int -Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, const char *DOMAIN) +Valid_User(char *username, char *password, const char *SERVER, const char *DOMAIN) { const char *supportedDialects[] = {"PC NETWORK PROGRAM 1.0", "MICchecROSOFT NETWORKS 1.03", @@ -43,7 +43,7 @@ Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, const char *DOMAI SMB_Discon(con, 0); return (NTV_PROTOCOL_ERROR); } - if (SMB_Logon_Server(con, USERNAME, PASSWORD, NULL, 0) < 0) { + if (SMB_Logon_Server(con, username, password, NULL, 0) < 0) { SMB_Discon(con, 0); return (NTV_LOGON_ERROR); }