]>
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" |
03901cf8 AJ |
10 | #include "auth/basic/SMB_LM/valid.h" |
11 | #include "smblib/smblib.h" | |
12 | ||
7c16470c | 13 | #if HAVE_SYS_TYPES_H |
94439e4e | 14 | #include <sys/types.h> |
7c16470c AJ |
15 | #endif |
16 | #if HAVE_UNISTD_H | |
94439e4e | 17 | #include <unistd.h> |
7c16470c AJ |
18 | #endif |
19 | #if HAVE_SYSLOG_H | |
94439e4e | 20 | #include <syslog.h> |
7c16470c | 21 | #endif |
94439e4e | 22 | |
ae81e9ec | 23 | // BACKUP is unused |
94439e4e | 24 | int |
ced8def3 | 25 | Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, char *, const char *DOMAIN) |
94439e4e | 26 | { |
d5f8d05f | 27 | const char *supportedDialects[] = {"PC NETWORK PROGRAM 1.0", |
0cc4a8bc A |
28 | "MICROSOFT NETWORKS 1.03", |
29 | "MICROSOFT NETWORKS 3.0", | |
30 | "LANMAN1.0", | |
31 | "LM1.2X002", | |
32 | "Samba", | |
33 | "NT LM 0.12", | |
34 | "NT LANMAN 1.0", | |
35 | NULL | |
36 | }; | |
7c16470c | 37 | SMB_Handle_Type con; |
94439e4e | 38 | |
39 | SMB_Init(); | |
40 | con = SMB_Connect_Server(NULL, SERVER, DOMAIN); | |
ae81e9ec FC |
41 | if (con == NULL) { |
42 | return (NTV_SERVER_ERROR); | |
94439e4e | 43 | } |
f53969cc | 44 | if (SMB_Negotiate(con, supportedDialects) < 0) { /* An error */ |
26ac0430 AJ |
45 | SMB_Discon(con, 0); |
46 | return (NTV_PROTOCOL_ERROR); | |
94439e4e | 47 | } |
7c16470c | 48 | if (SMB_Logon_Server(con, USERNAME, PASSWORD, NULL, 0) < 0) { |
26ac0430 AJ |
49 | SMB_Discon(con, 0); |
50 | return (NTV_LOGON_ERROR); | |
94439e4e | 51 | } |
52 | SMB_Discon(con, 0); | |
53 | return (NTV_NO_ERROR); | |
54 | } | |
f53969cc | 55 |