]>
Commit | Line | Data |
---|---|---|
5b95b903 | 1 | /* |
ef57eb7b | 2 | * Copyright (C) 1996-2016 The Squid Software Foundation and contributors |
5b95b903 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
f7f3304a | 9 | #include "squid.h" |
7c16470c | 10 | #if HAVE_SYS_TYPES_H |
94439e4e | 11 | #include <sys/types.h> |
7c16470c AJ |
12 | #endif |
13 | #if HAVE_UNISTD_H | |
94439e4e | 14 | #include <unistd.h> |
7c16470c AJ |
15 | #endif |
16 | #if HAVE_SYSLOG_H | |
94439e4e | 17 | #include <syslog.h> |
7c16470c AJ |
18 | #endif |
19 | #include "smblib/smblib.h" | |
94439e4e | 20 | #include "valid.h" |
21 | ||
ae81e9ec | 22 | // BACKUP is unused |
94439e4e | 23 | int |
ced8def3 | 24 | Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, char *, const char *DOMAIN) |
94439e4e | 25 | { |
d5f8d05f | 26 | const char *supportedDialects[] = {"PC NETWORK PROGRAM 1.0", |
0cc4a8bc A |
27 | "MICROSOFT NETWORKS 1.03", |
28 | "MICROSOFT NETWORKS 3.0", | |
29 | "LANMAN1.0", | |
30 | "LM1.2X002", | |
31 | "Samba", | |
32 | "NT LM 0.12", | |
33 | "NT LANMAN 1.0", | |
34 | NULL | |
35 | }; | |
7c16470c | 36 | SMB_Handle_Type con; |
94439e4e | 37 | |
38 | SMB_Init(); | |
39 | con = SMB_Connect_Server(NULL, SERVER, DOMAIN); | |
ae81e9ec FC |
40 | if (con == NULL) { |
41 | return (NTV_SERVER_ERROR); | |
94439e4e | 42 | } |
f53969cc | 43 | if (SMB_Negotiate(con, supportedDialects) < 0) { /* An error */ |
26ac0430 AJ |
44 | SMB_Discon(con, 0); |
45 | return (NTV_PROTOCOL_ERROR); | |
94439e4e | 46 | } |
7c16470c | 47 | if (SMB_Logon_Server(con, USERNAME, PASSWORD, NULL, 0) < 0) { |
26ac0430 AJ |
48 | SMB_Discon(con, 0); |
49 | return (NTV_LOGON_ERROR); | |
94439e4e | 50 | } |
51 | SMB_Discon(con, 0); | |
52 | return (NTV_NO_ERROR); | |
53 | } | |
f53969cc | 54 |