--------------------- PatchSet 514 Date: 2000/08/08 15:30:15 Author: kinkie Branch: ntlm Tag: (none) Log: Added command-line arguments support. Members: ntlm_auth_modules/NTLMSSP/ntlm.h:1.1.2.3->1.1.2.4 ntlm_auth_modules/NTLMSSP/ntlm_auth.c:1.1.2.3->1.1.2.4 Index: squid/ntlm_auth_modules/NTLMSSP/ntlm.h =================================================================== RCS file: /cvsroot/squid-sf//squid/ntlm_auth_modules/NTLMSSP/Attic/ntlm.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid/ntlm_auth_modules/NTLMSSP/ntlm.h 8 Aug 2000 13:19:08 -0000 1.1.2.3 +++ squid/ntlm_auth_modules/NTLMSSP/ntlm.h 8 Aug 2000 15:30:15 -0000 1.1.2.4 @@ -18,15 +18,6 @@ #ifndef _NTLM_H_ #define _NTLM_H_ -#define NTLM_STATIC_CHALLENGE "deadbeef" - -#if 0 -#define NTLM_DOMAIN "GCSINT" /* must be upper-case */ -#define DOMAIN_CONTROLLER "supervisor" -#else -#define NTLM_DOMAIN "OSHR" /* must be upper-case */ -#define DOMAIN_CONTROLLER "LIFELESSL" -#endif #define DEBUG @@ -61,7 +52,7 @@ /* NTLM request types that we know about */ #define NTLM_NEGOTIATE 1 #define NTLM_CHALLENGE 2 -#define NTLM_CHALLENGE_HEADER_OFFSET 48 +#define NTLM_CHALLENGE_HEADER_OFFSET 40 #define NTLM_AUTHENTICATE 3 #define NONCE_LEN 8 @@ -182,4 +173,8 @@ char* make_challenge(); int ntlm_check_auth(ntlmssp *got); + +extern char *domain; +extern char *domain_controller; + #endif /* _NTLM_H_ */ Index: squid/ntlm_auth_modules/NTLMSSP/ntlm_auth.c =================================================================== RCS file: /cvsroot/squid-sf//squid/ntlm_auth_modules/NTLMSSP/Attic/ntlm_auth.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid/ntlm_auth_modules/NTLMSSP/ntlm_auth.c 8 Aug 2000 13:20:40 -0000 1.1.2.3 +++ squid/ntlm_auth_modules/NTLMSSP/ntlm_auth.c 8 Aug 2000 15:30:15 -0000 1.1.2.4 @@ -18,8 +18,10 @@ #include "ntlm.h" #include "util.h" -#include +#if HAVE_CTYPE_H +#include +#endif #if HAVE_STDIO_H #include #endif @@ -29,13 +31,58 @@ #if HAVE_STRING_H #include #endif +#if HAVE_GETOPT_H +#include +#endif +#if HAVE_UNISTD_H +#include +#endif + +char *domain = NULL, *domain_controller = NULL; +/* + * options: + * -d domain + * -s domain controller (backup DCs will be added later) + */ +void process_options (int argc, char *argv[]) { + int opt; + char *c; + while (-1!=(opt=getopt(argc,argv,"d:s:"))) { + switch(opt) { + case 'd': + domain=optarg; + for (c=optarg;*c!='\0';c++) + *c=(char)toupper(*c); + break; + case 's': + domain_controller=optarg; + for (c=optarg;*c!='\0';c++) + *c=(char)toupper(*c); + break; + default: + fprintf(stderr,"unknown option: -%c. Exiting\n",opt); + exit(1); + } + } +} int main(int argc, char *argv[]) { char buf[10240]; ntlmssp *got; char *ch; + process_options(argc,argv); + if (domain==NULL) { + fprintf(stderr,"You must specify a domain (with the -d argument)\n"); + exit(1); + } + if (domain_controller==NULL) { + fprintf(stderr,"You must specify a domain controller " + "(with the -s argument)\n"); + exit(1); + } + setbuf(stdout,NULL); setbuf(stderr,NULL);