LDAPMessage *res = NULL;
LDAPMessage *entry;
char *searchattr[] =
- {LDAP_NO_ATTRS, NULL};
+ {(char *)LDAP_NO_ATTRS, NULL};
char *userdn;
int rc;
LDAP *search_ld = persistent_ld;
/*
- * $Id: pam_auth.c,v 1.16 2005/07/02 18:34:03 serassio Exp $
+ * $Id: pam_auth.c,v 1.17 2007/07/19 03:36:05 hno Exp $
*
* PAM authenticator module for Squid.
* Copyright (C) 1999,2002,2003 Henrik Nordstrom <hno@squid-cache.org>
char buf[BUFSIZE];
time_t pamh_created = 0;
int ttl = DEFAULT_SQUID_PAM_TTL;
- char *service = DEFAULT_SQUID_PAM_SERVICE;
+ const char *service = DEFAULT_SQUID_PAM_SERVICE;
int no_acct_mgmt = 0;
/* make standard output line buffered */
/*
- * $Id: sasl_auth.c,v 1.8 2004/12/20 16:30:16 robertc Exp $
+ * $Id: sasl_auth.c,v 1.9 2007/07/19 03:36:05 hno Exp $
*
* SASL authenticator module for Squid.
* Copyright (C) 2002 Ian Castle <ian.castle@coldcomfortfarm.net>
#define APP_NAME_SASL "squid_sasl_auth"
int
-main()
+main(int argc, char *argv[])
{
char line[8192];
char *username, *password;
#define PROGRAM_NAME "digest_ldap_auth"
-void
+static void
GetHHA1(RequestData * requestData)
{
LDAPHHA1(requestData);
OutputHHA1(&requestData);
}
-void
+static void
ProcessArguments(int argc, char **argv)
{
int i;
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
+
+#include "edir_ldapext.h"
+
/* NMAS error codes */
#define NMAS_E_BASE (-1600)
/* Globals */
static LDAP *ld = NULL;
-static char *passattr = NULL;
+static const char *passattr = NULL;
static char *ldapServer = NULL;
-static char *userbasedn = NULL;
-static char *userdnattr = NULL;
-static char *usersearchfilter = NULL;
-static char *binddn = NULL;
-static char *bindpasswd = NULL;
-static char *delimiter = ":";
+static const char *userbasedn = NULL;
+static const char *userdnattr = NULL;
+static const char *usersearchfilter = NULL;
+static const char *binddn = NULL;
+static const char *bindpasswd = NULL;
+static const char *delimiter = ":";
static int encrpass = 0;
static int searchscope = LDAP_SCOPE_SUBTREE;
static int persistent = 0;
#endif
static void ldapconnect(void);
-static int readSecret(char *filename);
+static int readSecret(const char *filename);
/* Yuck.. we need to glue to different versions of the API */
setbuf(stdout, NULL);
while (argc > 1 && argv[1][0] == '-') {
- char *value = "";
+ const char *value = "";
char option = argv[1][1];
switch (option) {
case 'P':
}
if (!ldapServer)
- ldapServer = "localhost";
+ ldapServer = (char *)"localhost";
if (!userbasedn || !((passattr != NULL) || (edir_universal_passwd && usersearchfilter && version == LDAP_VERSION3 && use_tls))) {
fprintf(stderr, "Usage: " PROGRAM_NAME " -b basedn -f filter [options] ldap_server_name\n\n");
return 0;
}
static int
-readSecret(char *filename)
+readSecret(const char *filename)
{
char buf[BUFSIZ];
char *e = 0;
if ((e = strrchr(buf, '\r')))
*e = 0;
- bindpasswd = (char *) calloc(sizeof(char), strlen(buf) + 1);
- if (bindpasswd) {
- strcpy(bindpasswd, buf);
- } else {
+ bindpasswd = strdup(buf);
+ if (!bindpasswd) {
fprintf(stderr, PROGRAM_NAME " ERROR: can not allocate memory\n");
}
void
LDAPHHA1(RequestData * requestData)
{
- char *password = "";
+ char *password;
ldapconnect();
password = getpassword(requestData->user, requestData->realm);
if (password != NULL) {
#define PROGRAM_NAME "digest_ldap_auth"
-void
+static void
GetHHA1(RequestData * requestData)
{
LDAPHHA1(requestData);
OutputHHA1(&requestData);
}
-void
+static void
ProcessArguments(int argc, char **argv)
{
int i;
/* Globals */
static LDAP *ld = NULL;
-static char *passattr = NULL;
+static const char *passattr = NULL;
static char *ldapServer = NULL;
-static char *userbasedn = NULL;
-static char *userdnattr = NULL;
-static char *usersearchfilter = NULL;
-static char *binddn = NULL;
-static char *bindpasswd = NULL;
-static char *delimiter = ":";
+static const char *userbasedn = NULL;
+static const char *userdnattr = NULL;
+static const char *usersearchfilter = NULL;
+static const char *binddn = NULL;
+static const char *bindpasswd = NULL;
+static const char *delimiter = ":";
static int encrpass = 0;
static int searchscope = LDAP_SCOPE_SUBTREE;
static int persistent = 0;
#endif
static void ldapconnect(void);
-static int readSecret(char *filename);
+static int readSecret(const char *filename);
/* Yuck.. we need to glue to different versions of the API */
setbuf(stdout, NULL);
while (argc > 1 && argv[1][0] == '-') {
- char *value = "";
+ const char *value = "";
char option = argv[1][1];
switch (option) {
case 'P':
}
if (!ldapServer)
- ldapServer = "localhost";
+ ldapServer = (char *)"localhost";
if (!userbasedn || !passattr) {
fprintf(stderr, "Usage: " PROGRAM_NAME " -b basedn -f filter [options] ldap_server_name\n\n");
return 0;
}
static int
-readSecret(char *filename)
+readSecret(const char *filename)
{
char buf[BUFSIZ];
char *e = 0;
if ((e = strrchr(buf, '\r')))
*e = 0;
- bindpasswd = (char *) calloc(sizeof(char), strlen(buf) + 1);
- if (bindpasswd) {
- strcpy(bindpasswd, buf);
- } else {
+ bindpasswd = strdup(buf);
+ if (!bindpasswd) {
fprintf(stderr, PROGRAM_NAME " ERROR: can not allocate memory\n");
}
void
LDAPHHA1(RequestData * requestData)
{
- char *password = "";
+ char *password;
ldapconnect();
password = getpassword(requestData->user, requestData->realm);
if (password != NULL) {
#include "text_backend.h"
#define PROGRAM_NAME "digest_pw_auth"
-
-void
-usage()
-{
- fprintf(stderr, "\n\t\tYou need at least to specify the backend database\n");
- fprintf(stderr, "\t\t%s -D LDAP or file\n", PROGRAM_NAME);
- exit(1);
-}
-
-void
+static void
GetHHA1(RequestData * requestData)
{
TextHHA1(requestData);
OutputHHA1(&requestData);
}
-void
+static void
ProcessArguments(int argc, char **argv)
{
TextArguments(argc, argv);
-/* $Id: main.c,v 1.5 2005/07/02 18:34:03 serassio Exp $
+/* $Id: main.c,v 1.6 2007/07/19 03:36:12 hno Exp $
* Copyright (C) 2002 Rodrigo Campos
*
* This program is free software; you can redistribute it and/or modify
#include "ip_user.h"
-void
+static void
usage (char *program_name)
{
fprintf (stderr, "Usage:\n%s -f <configuration file>\n",
-/* $Id: match.c,v 1.2 2003/01/23 00:36:01 robertc Exp $
+/* $Id: match.c,v 1.3 2007/07/19 03:36:12 hno Exp $
* Copyright (C) 2002 Rodrigo Campos
*
* This program is free software; you can redistribute it and/or modify
#include <sys/types.h>
#include <grp.h>
+#include "ip_user.h"
int
match_user (char *dict_username, char *username)
/* Globals */
-static char *basedn = NULL;
-static char *searchfilter = NULL;
-static char *userbasedn = NULL;
-static char *userdnattr = NULL;
-static char *usersearchfilter = NULL;
-static char *binddn = NULL;
-static char *bindpasswd = NULL;
+static const char *basedn = NULL;
+static const char *searchfilter = NULL;
+static const char *userbasedn = NULL;
+static const char *userdnattr = NULL;
+static const char *usersearchfilter = NULL;
+static const char *binddn = NULL;
+static const char *bindpasswd = NULL;
static int searchscope = LDAP_SCOPE_SUBTREE;
static int persistent = 0;
static int noreferrals = 0;
static int searchLDAP(LDAP * ld, char *group, char *user, char *extension_dn);
-static int readSecret(char *filename);
+static int readSecret(const char *filename);
/* Yuck.. we need to glue to different versions of the API */
setbuf(stdout, NULL);
while (argc > 1 && argv[1][0] == '-') {
- char *value = "";
+ const char *value = "";
char option = argv[1][1];
switch (option) {
case 'P':
}
if (!ldapServer)
- ldapServer = "localhost";
+ ldapServer = (char *)"localhost";
if (!basedn || !searchfilter) {
fprintf(stderr, "\n" PROGRAM_NAME " version " PROGRAM_VERSION "\n\n");
LDAPMessage *res = NULL;
LDAPMessage *entry;
int rc;
- char *searchattr[] = {LDAP_NO_ATTRS, NULL};
+ char *searchattr[] = {(char *)LDAP_NO_ATTRS, NULL};
if (extension_dn && *extension_dn)
snprintf(searchbase, sizeof(searchbase), "%s,%s", extension_dn, basedn);
LDAPMessage *entry;
int rc;
char *userdn;
- char *searchattr[] = {LDAP_NO_ATTRS, NULL};
+ char *searchattr[] = {(char *)LDAP_NO_ATTRS, NULL};
if (extension_dn && *extension_dn)
snprintf(searchbase, sizeof(searchbase), "%s,%s", extension_dn, userbasedn ? userbasedn : basedn);
else
}
-int readSecret(char *filename)
+int readSecret(const char *filename)
{
char buf[BUFSIZ];
char *e=0;
if((e = strrchr(buf, '\n'))) *e = 0;
if((e = strrchr(buf, '\r'))) *e = 0;
- bindpasswd = (char *) calloc(sizeof(char), strlen(buf)+1);
- if (bindpasswd) {
- strcpy(bindpasswd, buf);
- } else {
+ bindpasswd = strdup(buf);
+ if (!bindpasswd) {
fprintf(stderr, PROGRAM_NAME " ERROR: can not allocate memory\n");
}
#define BUFFER_SIZE 10240
-char *authenticate_ntlm_domain = "WORKGROUP";
+const char *authenticate_ntlm_domain = "WORKGROUP";
int debug_enabled = 0;
int NTLM_packet_debug_enabled = 0;
/* NTLM authentication by ad@interlude.eu.org - 07/1999 */
/* XXX this is not done cleanly... */
-void
+static void
hex_dump(void *data, int size)
{
/* dumps size bytes of *data to stdout. Looks like:
/*
* Decode the strings in an NTLM authentication request
*/
-int
+static int
ntlmDecodeAuth(struct ntlm_authenticate *auth, char *buf, size_t size)
{
- char *p, *origbuf;
+ const char *p;
+ char *origbuf;
int s;
if (!buf) {
*/
char *my_program_name = NULL;
-void
-usage()
+static void
+usage(void)
{
fprintf(stderr,
"Usage: %s [-d] [-v] [-h]\n"
}
-void
+static void
process_options(int argc, char *argv[])
{
int opt, had_error = 0;
#define DEFAULT_HASH_SIZE 7951
+extern "C" {
typedef unsigned int HASHHASH(const void *, unsigned int);
struct _hash_link {
char *key;
HASHHASH hash_string;
HASHHASH hash_url;
HASHHASH hash4;
+
+}