initial import to git

This commit is contained in:
z3APA3A committed 2014-04-08 13:03:21 +04:00
commit a060376f1e
217 files changed
+64253

No files matched your search

@@ -0,0 +1,4 @@
/Makefile/1.3/Tue Jan 23 15:46:31 2007//
/Makefile.inc/1.5/Fri Apr 6 14:12:06 2007//
/WindowsAuthentication.c/1.12/Tue Apr 12 13:05:58 2011//
D
@@ -0,0 +1 @@
3proxy-0.5a/src/plugins/WindowsAuthentication
@@ -0,0 +1 @@
/cygdrive/m/MEDIA/H/CVS
@@ -0,0 +1 @@
include Makefile.var
@@ -0,0 +1,8 @@
all: $(BUILDDIR)WindowsAuthentication$(DLSUFFICS)
WindowsAuthentication$(OBJSUFFICS): WindowsAuthentication.c
$(CC) $(DCFLAGS) $(CFLAGS) WindowsAuthentication.c
$(BUILDDIR)WindowsAuthentication$(DLSUFFICS): WindowsAuthentication$(OBJSUFFICS)
$(LN) $(LNOUT)../../$(BUILDDIR)WindowsAuthentication$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) WindowsAuthentication$(OBJSUFFICS) $(LIBS)
@@ -0,0 +1,37 @@
VERFILE = version.obj ../3proxy.RES
#$Id: Makefile.msvc,v 1.17 2010-11-11 14:44:11 v.dubrovin Exp $
#
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
#
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
# libraries
#
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
BUILDDIR = ../bin/
CC = cl
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c
COUT = /Fo
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
DLFLAGS = /DLL
DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
LIBEXT = .lib
LNOUT = /out:
EXESUFFICS = .exe
OBJSUFFICS = .obj
DEFINEOPTION = /D
COMPFILES = *.pch *.idb
REMOVECOMMAND = del 2>NUL >NUL
TYPECOMMAND = type
COMPATLIBS =
MAKEFILE = Makefile.msvc
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin lastFripper FilePlugin
include Makefile.inc
allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
@@ -0,0 +1,103 @@
/*
3APA3A simpliest proxy server
(c) 2007-2008 by ZARAZA <3APA3A@security.nnov.ru>
please read License Agreement
$Id: WindowsAuthentication.c,v 1.12 2011-04-12 13:05:58 v.dubrovin Exp $
*/
#include "../../structures.h"
#include <string.h>
#include <ctype.h>
#include <locale.h>
#ifdef __cplusplus
extern "C" {
#endif
__declspec(dllexport) int WindowsAuthentication(struct pluginlink * pluginlink,
int argc, char** argv);
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
static struct auth alwaysauth;
static char sidbuf[4096];
static PSID psid = (PSID)sidbuf;
#ifdef __cplusplus
extern "C" {
#endif
static int windowsfunc(struct clientparam *param){
char *dom;
HANDLE h;
DWORD dw, sidlen, i;
char tokenbuf[4096];
PTOKEN_GROUPS ptg = (PTOKEN_GROUPS)tokenbuf;
if(!param->username || !param->password || param->pwtype != 0) return 4;
dom = strchr((char *)param->username, '\\');
if(dom)*dom++=0;
if(!LogonUser( dom?dom:(char *)param->username,
dom?(char *)param->username:NULL,
param->password,
LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT,
&h))return 5;
if(dom)*(dom-1)='\\';
if(!GetTokenInformation(h, TokenGroups, ptg, sizeof(tokenbuf), &dw)) return 6;
CloseHandle(h);
sidlen = GetLengthSid(psid);
for(i=0; i < ptg->GroupCount; i++){
if(GetLengthSid(ptg->Groups[i].Sid)==sidlen){
if(!memcmp((void *)ptg->Groups[i].Sid, (void *)psid, sidlen)) {
setlocale(LC_CTYPE, ".ACP");
_strlwr(param->username);
return 0;
}
}
}
return 7;
}
#ifdef __cplusplus
}
#endif
int WindowsAuthentication(struct pluginlink * pluginlink, int argc, char** argv){
char tmpbuf[4096];
DWORD dlen, sidlen;
SID_NAME_USE snu;
static int loaded = 0;
if(argc != 2) return 11;
dlen = sizeof(tmpbuf)/sizeof(TCHAR);
sidlen = sizeof(sidbuf);
if(!LookupAccountName(NULL, argv[1], psid, &sidlen,
(LPTSTR) tmpbuf, &dlen, &snu)) return 100000 + (int)GetLastError();
if(snu != SidTypeGroup && snu != SidTypeAlias && snu != SidTypeWellKnownGroup) return 12;
if(!loaded){
alwaysauth.authenticate = windowsfunc;
alwaysauth.authorize = pluginlink->checkACL;
alwaysauth.desc = "windows";
alwaysauth.next = pluginlink->authfuncs->next;
pluginlink->authfuncs->next = &alwaysauth;
loaded = 1;
}
return 0;
}
+31
View File
@@ -0,0 +1,31 @@
3proxy 0.6 Windows Authentication Plugin Public License Agreement
This software provided "as is" without any guaranties or support.
This software is FREEWARE. You can use it under terms of current version
of GNU GPL (General Public License) available from
http://www.gnu.org/licenses/gpl.txt or under conditions below:
1. You are granted non-exclusive rights to compile, modify, use and
re-distribute this program.
2. In case this software is redistributed in binary form, source code
MUST be available for user for free.
3. In case this software redistributed embedded in hardware device or
pre-installed version of operation system and source code is not available,
documentation MUST refer to http://www.security.nnov.ru/ as a source of
software.
4. In case this software is modified or is used as a part of another project
license MUST NOT be modified.
5. Authors of this software MAY change terms of this license for future
versions of this product.
(c) 2000-2009 by 3APA3A (3APA3A@security.nnov.ru)
(c) 2000-2009 by SECURITY.NNOV (http://www.security.nnov.ru)
(c) 2000-2009 by Vladimir Dubrovin (vlad@sandy.ru)
This software uses:
RSA Data Security, Inc. MD4 Message-Digest Algorithm
RSA Data Security, Inc. MD5 Message-Digest Algorithm
$Id: copying,v 1.1 2006/02/13 16:08:03 vlad Exp $