source: squid-ssl/trunk/fuentes/helpers/basic_auth/SMB_LM/valid.cc @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 1.6 KB
Line 
1/*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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
9#include "squid.h"
10#if HAVE_SYS_TYPES_H
11#include <sys/types.h>
12#endif
13#if HAVE_UNISTD_H
14#include <unistd.h>
15#endif
16#if HAVE_SYSLOG_H
17#include <syslog.h>
18#endif
19#include "smblib/smblib.h"
20#include "valid.h"
21
22// BACKUP is unused
23int
24Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, char *BACKUP, const char *DOMAIN)
25{
26    const char *supportedDialects[] = {"PC NETWORK PROGRAM 1.0",
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                                      };
36    SMB_Handle_Type con;
37
38    SMB_Init();
39    con = SMB_Connect_Server(NULL, SERVER, DOMAIN);
40    if (con == NULL) {
41        return (NTV_SERVER_ERROR);
42    }
43    if (SMB_Negotiate(con, supportedDialects) < 0) {    /* An error */
44        SMB_Discon(con, 0);
45        return (NTV_PROTOCOL_ERROR);
46    }
47    if (SMB_Logon_Server(con, USERNAME, PASSWORD, NULL, 0) < 0) {
48        SMB_Discon(con, 0);
49        return (NTV_LOGON_ERROR);
50    }
51    SMB_Discon(con, 0);
52    return (NTV_NO_ERROR);
53}
54
Note: See TracBrowser for help on using the repository browser.