Update of /cvsroot/mahogany/M/lib/dspam
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6178
Modified Files:
dspam.c libdspam.c storage_driver.h util.c
Log Message:
after DSPAM_SNAP_20041003 merge
Index: dspam.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/dspam.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -b -u -2 -r1.6 -r1.7
--- dspam.c 2 Oct 2004 13:32:45 -0000 1.6
+++ dspam.c 3 Oct 2004 21:36:46 -0000 1.7
@@ -38,4 +38,7 @@
#include <io.h>
#include <process.h>
+#define WIFEXITED(x) 1
+#define WEXITSTATUS(x) (x)
+#include <windows.h> /* for GetTickCount() */
#else
#include <sys/wait.h>
@@ -67,5 +70,27 @@
#include "pref.h"
-struct timeval tv_start, tv_end;
+static double timeStart;
+
+/*
+ under Win32, this function returns time since system boot, not time since
+ Epoch, but this is fine because we only use it to compute time differences
+ (if it is ever a problem, we can use Win32 ::GetLocalTime() as well)
+ */
+static double GetTimeInSeconds()
+{
+ double t;
+
+#ifdef _WIN32
+ t = GetTickCount()/1000.;
+#else /* !_WIN32 */
+ struct timeval tv;
+ if ( gettimeofday(&tv, NULL) != -1 )
+ t = tv.tv_usec/1000000.0 + tv.tv_sec;
+ else
+ t = 0.;
+#endif /* _WIN32/!_WIN32 */
+
+ return t;
+}
#ifndef CONFIGURE_ARGS
@@ -91,4 +116,5 @@
int i, line = 1;
int user_flag = 0; /* Next argument(s) are users */
+ int feature_flag = 0; /* Any features specified? */
#ifdef TRUSTED_USER_SECURITY
int trusted = 0;
@@ -102,5 +128,5 @@
int retcode, exitcode = EXIT_SUCCESS;
- gettimeofday(&tv_start, NULL);
+ timeStart = GetTimeInSeconds();
#ifdef DEBUG
@@ -192,17 +218,5 @@
{
char *mode = strchr(argv[i], '=')+1;
- if (!strcmp(mode, "toe"))
- ATX.training_mode = DST_TOE;
- else if (!strcmp(mode, "teft"))
- ATX.training_mode = DST_TEFT;
- else if (!strcmp(mode, "tum"))
- ATX.training_mode = DST_TUM;
- else if (!strcmp(mode, "notrain"))
- ATX.training_mode = DST_NOTRAIN;
- else
- {
- report_error_printf("invalid mode '%s'", mode);
- exit(EXIT_FAILURE);
- }
+ process_mode(&ATX, mode);
continue;
@@ -250,5 +264,12 @@
"General Public License,\n");
printf ("a copy of which can be found with the DSPAM distribution "
- "kit.\n\nConfiguration parameters: %s\n\n", CONFIGURE_ARGS);
+ "kit.\n\n");
+#ifdef TRUSTED_USER_SECURITY
+ if (trusted) {
+#endif
+ printf("Configuration parameters: %s\n\n", CONFIGURE_ARGS);
+#ifdef TRUSTED_USER_SECURITY
+ }
+#endif
exit (EXIT_SUCCESS);
}
@@ -365,37 +386,6 @@
if (!strncmp (argv[i], "--feature=", 10))
{
- char *d = strdup(strchr(argv[i], '=')+1);
- char *s;
- if (d == NULL) {
- report_error(ERROR_MEM_ALLOC);
- exit(EXIT_FAILURE);
- }
-
- s = strtok(d, ",");
- while(s != NULL) {
- if (!strcmp(s, "chained") || !strcmp(s, "ch"))
- ATX.flags |= DAF_CHAINED;
- else if (!strcmp(s, "sbph") || !strcmp(s, "sb"))
- ATX.flags |= DAF_SBPH;
- else if (!strcmp(s, "noise") || !strcmp(s, "no") || !strcmp(s, "bnr"))
- ATX.flags |= DAF_NOISE;
- else if (!strcmp(s, "whitelist") || !strcmp(s, "wh"))
- ATX.flags |= DAF_WHITELIST;
- else if (!strncmp(s, "tb=", 3)) {
- ATX.training_buffer = atoi(strchr(s, '=')+1);
- if (ATX.training_buffer < 0 || ATX.training_buffer > 10) {
- report_error("training buffer level specified is invalid");
- exit(EXIT_FAILURE);
- }
- }
- else
- {
- report_error_printf("unknown feature '%s'", s);
- exit(EXIT_FAILURE);
- }
-
- s = strtok(NULL, ",");
- }
- free(d);
+ feature_flag = 1;
+ process_features(&ATX, strchr(argv[i], '=')+1);
continue;
}
@@ -427,14 +417,5 @@
if (ATX.training_mode == -1) {
char *v = _ds_read_attribute(agent_config, "TrainingMode");
- if (v) {
- if (!strcasecmp(v, "teft"))
- ATX.training_mode = DST_TEFT;
- else if (!strcasecmp(v, "tum"))
- ATX.training_mode = DST_TUM;
- else if (!strcasecmp(v, "toe"))
- ATX.training_mode = DST_TOE;
- else if (!strcasecmp(v, "notrain"))
- ATX.training_mode = DST_NOTRAIN;
- }
+ process_mode(&ATX, v);
}
@@ -480,37 +461,9 @@
/* Features */
- if (_ds_find_attribute(agent_config, "Feature")) {
+ if (!feature_flag && _ds_find_attribute(agent_config, "Feature")) {
attribute_t *attrib = _ds_find_attribute(agent_config, "Feature");
while(attrib != NULL) {
- char *d = strdup(attrib->value);
- char *s;
-
- s = strtok(d, ",");
- while(s != NULL) {
- if (!strcmp(s, "chained") || !strcmp(s, "ch"))
- ATX.flags |= DAF_CHAINED;
- else if (!strcmp(s, "sbph") || !strcmp(s, "sb"))
- ATX.flags |= DAF_SBPH;
- else if (!strcmp(s, "noise") || !strcmp(s, "no") || !strcmp(s, "bnr"))
- ATX.flags |= DAF_NOISE;
- else if (!strcmp(s, "whitelist") || !strcmp(s, "wh"))
- ATX.flags |= DAF_WHITELIST;
- else if (!strncmp(s, "tb=", 3)) {
- ATX.training_buffer = atoi(strchr(s, '=')+1);
- if (ATX.training_buffer < 0 || ATX.training_buffer > 10) {
- report_error("training buffer level specified is invalid");
- exit(EXIT_FAILURE);
- }
- }
- else
- {
- report_error_printf("unknown feature '%s'", s);
- exit(EXIT_FAILURE);
- }
-
- s = strtok(NULL, ",");
- }
- free(d);
+ process_features(&ATX, attrib->value);
attrib = attrib->next;
}
@@ -678,5 +631,5 @@
LOGDEBUG("Loading preferences for user %s", (const char *) node_nt->ptr);
- PTX = _ds_pref_load(node_nt->ptr);
+ PTX = _ds_pref_load(node_nt->ptr, _ds_read_attribute(agent_config, "Home"));
if (_ds_match_attribute(agent_config, "Opt", "in")) {
@@ -744,6 +697,17 @@
(ATX.flags & DAF_STDOUT) ? NULL : ATX.mailer_args,
node_nt->ptr);
- if (retcode)
+ if (retcode) {
exitcode = retcode;
+ if ((result == DSR_ISINNOCENT || result == DSR_ISWHITELISTED) &&
+ _ds_match_attribute(agent_config, "OnFail", "unlearn") &&
+ ATX.learned)
+ {
+ ATX.classification =
+ (result == DSR_ISWHITELISTED) ? DSR_ISINNOCENT : result;
+ ATX.source = DSS_ERROR;
+ ATX.flags |= DAF_UNLEARN;
+ process_message (&ATX, PTX, message, node_nt->ptr);
+ }
+ }
}
}
@@ -758,4 +722,6 @@
{
+ retcode = 0;
+
/* If a specific quarantine has been configured, use it */
@@ -780,6 +746,4 @@
node_nt->ptr);
}
- if (retcode)
- exitcode = retcode;
}
}
@@ -789,7 +753,21 @@
if (ATX.source == DSS_INOCULATION || ATX.classification == -1) {
if (ATX.managed_group[0] == 0)
- quarantine_message (message->data, node_nt->ptr);
+ retcode = quarantine_message (message->data, node_nt->ptr);
else
- quarantine_message (message->data, ATX.managed_group);
+ retcode = quarantine_message (message->data, ATX.managed_group);
+ }
+ }
+
+ if (retcode) {
+ exitcode = retcode;
+
+ /* Unlearn the message on a local delivery failure */
+ if (_ds_match_attribute(agent_config, "OnFail", "unlearn") &&
+ ATX.learned) {
+ ATX.classification =
+ (result == DSR_ISWHITELISTED) ? DSR_ISINNOCENT : result;
+ ATX.source = DSS_ERROR;
+ ATX.flags |= DAF_UNLEARN;
+ process_message (&ATX, PTX, message, node_nt->ptr);
}
}
@@ -805,6 +783,15 @@
(ATX.flags & DAF_STDOUT) ? NULL : ATX.mailer_args,
node_nt->ptr);
- if (retcode)
+ if (retcode) {
exitcode = retcode;
+ if (_ds_match_attribute(agent_config, "OnFail", "unlearn") &&
+ ATX.learned) {
+ ATX.classification =
+ (result == DSR_ISWHITELISTED) ? DSR_ISINNOCENT : result;
+ ATX.source = DSS_ERROR;
+ ATX.flags |= DAF_UNLEARN;
+ process_message (&ATX, PTX, message, node_nt->ptr);
+ }
+ }
}
}
@@ -1016,4 +1003,7 @@
f_all = DSF_SIGNATURE;
+ if (ATX->flags & DAF_UNLEARN)
+ f_all |= DSF_UNLEARN;
+
if (ATX->flags & DAF_CHAINED)
f_all |= DSF_CHAINED;
@@ -1464,5 +1454,5 @@
if (!is_signed && ATX->classification == -1) {
strcpy (erase_begin, signature_end + 1);
- block->body->used = strlen(body);
+ block->body->used = (long)strlen(body);
}
}
@@ -1677,5 +1667,5 @@
result = DSR_ISINNOCENT;
}
- CTX->confidence = 0.60;
+ CTX->confidence = 0.60f;
}
@@ -1933,5 +1923,5 @@
char class;
char x[1024];
- int y;
+ size_t y;
_ds_userdir_path(filename, _ds_read_attribute(agent_config, "Home"), username,
"log");
@@ -2008,6 +1998,4 @@
if (_ds_match_attribute(agent_config, "SystemLog", "on")) {
- gettimeofday(&tv_end, NULL);
-
snprintf(filename, sizeof(filename), "%s/system.log",
_ds_read_attribute(agent_config, "Home"));
@@ -2016,13 +2004,7 @@
int i = _ds_get_fcntl_lock(fileno(file));
if (!i) {
- double start, stop;
char s[1024];
- start = tv_start.tv_usec/1000000.0;
- stop = tv_end.tv_usec/1000000.0;
- start += tv_start.tv_sec+0.0;
- stop += tv_end.tv_sec+0.0;
-
- snprintf(s, sizeof(s), "%s\t%f\n", x, stop-start);
+ snprintf(s, sizeof(s), "%s\t%f\n", x, GetTimeInSeconds()-timeStart);
fputs(s, file);
_ds_free_fcntl_lock(fileno(file));
@@ -2093,5 +2075,6 @@
long subject_length;
- subject_length = strlen(head->data)+strlen(spam_subject)+2;
+ subject_length = (long)
+ (strlen(head->data)+strlen(spam_subject)+2);
subject = malloc(subject_length);
if (subject != NULL) {
@@ -2105,6 +2088,6 @@
if (head->original_data != NULL) {
- subject_length =
- strlen(head->original_data)+strlen(spam_subject)+2;
+ subject_length = (long)
+ (strlen(head->original_data)+strlen(spam_subject)+2);
subject = malloc(subject_length);
@@ -2474,5 +2457,5 @@
{
dup = strdup (body_close);
- block->body->used -= strlen (dup);
+ block->body->used -= (long)strlen (dup);
body_close[0] = 0;
}
@@ -2576,4 +2559,6 @@
}
+ ATX->learned = CTX->learned;
+
if (CTX->message != NULL)
_ds_destroy_message (CTX->message);
@@ -2608,5 +2593,5 @@
{
char a[256], b[256];
- int i;
+ size_t i;
if (!strcmp (arg, "$u") || !strcmp (arg, "\\$u") || !strcmp (arg, "%u"))
@@ -2669,4 +2654,5 @@
}
}
+#ifndef _WIN32
else if (WIFSIGNALED (rc))
{
@@ -2682,4 +2668,5 @@
return rc;
}
+#endif /* _WIN32 */
return 0;
@@ -3002,2 +2989,66 @@
return 0;
}
+
+int process_features(AGENT_CTX *ATX, const char *features) {
+ char *s, *d;
+ int ret = 0;
+
+ if (features[0] == 0)
+ return 0;
+
+ d = strdup(features);
+ if (d == NULL) {
+ report_error(ERROR_MEM_ALLOC);
+ return EUNKNOWN;
+ }
+
+ s = strtok(d, ",");
+ while(s != NULL) {
+ if (!strcmp(s, "chained") || !strcmp(s, "ch"))
+ ATX->flags |= DAF_CHAINED;
+ else if (!strcmp(s, "sbph") || !strcmp(s, "sb"))
+ ATX->flags |= DAF_SBPH;
+ else if (!strcmp(s, "noise") || !strcmp(s, "no") || !strcmp(s, "bnr"))
+ ATX->flags |= DAF_NOISE;
+ else if (!strcmp(s, "whitelist") || !strcmp(s, "wh"))
+ ATX->flags |= DAF_WHITELIST;
+ else if (!strncmp(s, "tb=", 3)) {
+ ATX->training_buffer = atoi(strchr(s, '=')+1);
+ if (ATX->training_buffer < 0 || ATX->training_buffer > 10) {
+ report_error("training buffer level specified is invalid");
+ exit(EXIT_FAILURE);
+ }
+ }
+ else
+ {
+ report_error_printf("unknown feature '%s'", s);
+ ret = EINVAL;
+ }
+
+ s = strtok(NULL, ",");
+ }
+ free(d);
+ return ret;
+}
+
+int process_mode(AGENT_CTX *ATX, const char *mode) {
+ if (!strcmp(mode, "toe"))
+ ATX->training_mode = DST_TOE;
+ else if (!strcmp(mode, "teft"))
+ ATX->training_mode = DST_TEFT;
+ else if (!strcmp(mode, "tum"))
+ ATX->training_mode = DST_TUM;
+ else if (!strcmp(mode, "notrain"))
+ ATX->training_mode = DST_NOTRAIN;
+ else if (!strcmp(mode, "unlearn")) {
+ ATX->training_mode = DST_TEFT;
+ ATX->flags |= DAF_UNLEARN;
+ }
+ else
+ {
+ report_error_printf("invalid mode '%s'", mode);
+ return EINVAL;
+ }
+
+ return 0;
+}
Index: libdspam.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/libdspam.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -b -u -2 -r1.11 -r1.12
--- libdspam.c 2 Oct 2004 16:42:35 -0000 1.11
+++ libdspam.c 3 Oct 2004 21:36:46 -0000 1.12
@@ -1167,10 +1167,16 @@
if (CTX->result == DSR_ISSPAM && CTX->operating_mode != DSM_CLASSIFY)
{
+ if (!(CTX->flags & DSF_UNLEARN)) {
CTX->totals.spam_learned++;
+ CTX->learned = 1;
+ }
if (CTX->classification == DSR_ISSPAM)
{
- if (CTX->source == DSS_CORPUS || CTX->source == DSS_INOCULATION)
+ if (CTX->flags & DSF_UNLEARN) {
+ CTX->totals.spam_learned -= (CTX->totals.spam_learned > 0) ? 1 : 0;
+ } else if (CTX->source == DSS_CORPUS || CTX->source == DSS_INOCULATION) {
CTX->totals.spam_corpusfed++;
+ }
else if (SPAM_MISS(CTX))
{
@@ -1186,5 +1192,8 @@
&& CTX->operating_mode != DSM_CLASSIFY)
{
+ if (!(CTX->flags & DSF_UNLEARN)) {
CTX->totals.innocent_learned++;
+ CTX->learned = 1;
+ }
if (CTX->source == DSS_CORPUS || CTX->source == DSS_INOCULATION)
@@ -1194,8 +1203,12 @@
else if (FALSE_POSITIVE(CTX))
{
+ if (CTX->flags & DSF_UNLEARN) {
+ CTX->totals.innocent_learned -= (CTX->totals.innocent_learned >0) ? 1:0;
+ } else {
CTX->totals.innocent_misclassified++;
CTX->totals.spam_learned -= (CTX->totals.spam_learned > 0) ? 1 : 0;
}
}
+ }
/* TOE mode increments 'classified' totals */
@@ -1253,8 +1266,13 @@
else
{
+ if (CTX->flags & DSF_UNLEARN) {
+ if (CTX->classification == DSR_ISSPAM)
+ node_lht->s.spam_hits--;
+ } else {
node_lht->s.spam_hits++;
}
+ }
- if (SPAM_MISS(CTX)) {
+ if (SPAM_MISS(CTX) && !(CTX->flags & DSF_UNLEARN)) {
node_lht->s.innocent_hits--;
if (node_lht->s.innocent_hits < 0)
@@ -1266,7 +1284,12 @@
else
{
+ if (CTX->flags & DSF_UNLEARN) {
+ if (CTX->classification == DSR_ISINNOCENT)
+ node_lht->s.innocent_hits--;
+ } else {
node_lht->s.innocent_hits++;
+ }
- if (FALSE_POSITIVE(CTX))
+ if (FALSE_POSITIVE(CTX) && !(CTX->flags & DSF_UNLEARN))
{
@@ -1348,11 +1371,17 @@
CTX->result = -1;
+ if (!(CTX->flags & DSF_UNLEARN))
+ CTX->learned = 1;
+
/* INNOCENT */
if (CTX->classification == DSR_ISINNOCENT &&
CTX->operating_mode != DSM_CLASSIFY)
{
+ if (CTX->flags & DSF_UNLEARN) {
+ CTX->totals.innocent_learned -= (CTX->totals.innocent_learned) > 0 ? 1:0;
+ } else {
if (CTX->source == DSS_ERROR) {
CTX->totals.innocent_misclassified++;
- CTX->totals.spam_learned -= (CTX->totals.spam_learned > 0) ? 1 : 0;
+ CTX->totals.spam_learned -= (CTX->totals.spam_learned > 0) ? 1:0;
} else {
CTX->totals.innocent_corpusfed++;
@@ -1361,4 +1390,5 @@
CTX->totals.innocent_learned++;
}
+ }
/* SPAM */
@@ -1366,4 +1396,7 @@
CTX->operating_mode != DSM_CLASSIFY)
{
+ if (CTX->flags & DSF_UNLEARN) {
+ CTX->totals.spam_learned -= (CTX->totals.spam_learned > 0) ? 1 : 0;
+ } else {
if (CTX->source == DSS_ERROR) {
CTX->totals.spam_misclassified++;
@@ -1374,4 +1407,5 @@
CTX->totals.spam_learned++;
}
+ }
num_tokens = CTX->signature->length / sizeof (struct _ds_signature_token);
@@ -1397,12 +1431,19 @@
if (CTX->classification == DSR_ISINNOCENT)
{
+ if (CTX->flags & DSF_UNLEARN) {
+ node_lht->s.innocent_hits--;
+ } else {
node_lht->s.innocent_hits++;
if (CTX->source == DSS_ERROR)
node_lht->s.spam_hits -= (node_lht->s.spam_hits > 0) ? 1 : 0;
}
+ }
/* SPAM */
else if (CTX->classification == DSR_ISSPAM)
{
+ if (CTX->flags & DSF_UNLEARN) {
+ node_lht->s.spam_hits--;
+ } else {
if (CTX->source == DSS_ERROR)
node_lht->s.innocent_hits -= (node_lht->s.innocent_hits > 0) ? 1 : 0;
@@ -1419,4 +1460,5 @@
}
}
+ }
node_lht = c_lht_next (freq, &c_lht);
}
@@ -2090,5 +2132,5 @@
/* Bayesian Calculations */
-#if defined(BAYESIAN) || defined(DEBUG)
+#if defined(GRAHAM_BAYESIAN) || defined(DEBUG)
float bay_top = 0.0; /* Standard Bayesian */
float bay_bot = 0.0;
@@ -2097,5 +2139,5 @@
struct nt *factor_bayes = nt_create(NT_PTR);
#endif
-#if defined(ALT_BAYESIAN) || defined(DEBUG)
+#if defined(BURTON_BAYESIAN) || defined(DEBUG)
double abay_top = 0.0; /* Alternative Bayesian */
double abay_bot = 0.0;
@@ -2152,9 +2194,9 @@
/* Bayesian */
-#if defined(BAYESIAN) || defined(DEBUG)
+#if defined(GRAHAM_BAYESIAN) || defined(DEBUG)
if (bay_used < 15)
{
-#ifdef BAYESIAN
+#ifdef GRAHAM_BAYESIAN
#ifndef VERBOSE
if (CTX->operating_mode != DSM_CLASSIFY)
@@ -2187,8 +2229,8 @@
/* Alternative Bayesian */
-#if defined(ALT_BAYESIAN) || defined(DEBUG)
+#if defined(BURTON_BAYESIAN) || defined(DEBUG)
if (abay_used < 27)
{
-#ifdef ALT_BAYESIAN
+#ifdef BURTON_BAYESIAN
if (CTX->operating_mode != DSM_CLASSIFY)
{
@@ -2216,5 +2258,5 @@
if (abay_used < 27 && lht_getfrequency (freq, crc) > 1 )
{
-#ifdef ALT_BAYESIAN
+#ifdef BURTON_BAYESIAN
if (CTX->operating_mode != DSM_CLASSIFY)
{
@@ -2353,10 +2395,10 @@
/* BEGIN Calculate Individual Probabilities */
-#if defined(BAYESIAN) || defined(DEBUG)
+#if defined(GRAHAM_BAYESIAN) || defined(DEBUG)
bay_result = (bay_top) / (bay_top + bay_bot);
LOGDEBUG ("Bayes Probability: %f Samples: %ld", bay_result, bay_used);
#endif
-#if defined(ALT_BAYESIAN) || defined(DEBUG)
+#if defined(BURTON_BAYESIAN) || defined(DEBUG)
abay_result = (abay_top) / (abay_top + abay_bot);
LOGDEBUG ("Alternative Bayes Probability: %f Samples: %ld", abay_result,
@@ -2413,5 +2455,5 @@
struct nt *factor = NULL;
-#ifdef BAYESIAN
+#ifdef GRAHAM_BAYESIAN
factor = factor_bayes;
if (bay_result >= 0.9)
@@ -2423,5 +2465,5 @@
#endif
-#ifdef ALT_BAYESIAN
+#ifdef BURTON_BAYESIAN
factor = factor_altbayes;
if (abay_result >= 0.9)
@@ -2462,9 +2504,9 @@
}
-#ifdef BAYES
+#ifdef GRAHAM_BAYESIAN
if (CTX->factors != factor_bayes)
nt_destroy(factor_bayes);
#endif
-#ifdef ALTBAYES
+#ifdef BURTON_BAYESIAN
if (CTX->factors != factor_altbayes)
nt_destroy(factor_altbayes);
@@ -2482,9 +2524,9 @@
if (CTX->probability)
{
-#ifdef BAYESIAN
+#ifdef GRAHAM_BAYESIAN
CTX->probability = bay_result;
#endif
-#ifdef ALT_BAYESIAN
+#ifdef BURTON_BAYESIAN
if (CTX->probability < 0)
CTX->probability = abay_result;
Index: storage_driver.h
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/storage_driver.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -u -2 -r1.5 -r1.6
--- storage_driver.h 2 Oct 2004 13:32:46 -0000 1.5
+++ storage_driver.h 3 Oct 2004 21:36:46 -0000 1.6
@@ -114,8 +114,9 @@
#ifdef PREFERENCES_EXTENSION
-AGENT_PREF _ds_pref_load(const char *user);
-int _ds_pref_save(const char *user, AGENT_PREF PTX);
-int _ds_pref_set(const char *user, const char *attrib, const char *value);
-int _ds_pref_del(const char *username, const char *attrib);
+AGENT_PREF _ds_pref_load(const char *user, const char *home);
+int _ds_pref_save(const char *user, const char *home, AGENT_PREF PTX);
+int _ds_pref_set(const char *user, const char *home, const char *attrib,
+ const char *value);
+int _ds_pref_del(const char *user, const char *home, const char *attrib);
#endif
Index: util.c
===================================================================
RCS file: /cvsroot/mahogany/M/lib/dspam/util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -u -2 -r1.10 -r1.11
--- util.c 2 Oct 2004 14:51:24 -0000 1.10
+++ util.c 3 Oct 2004 21:36:46 -0000 1.11
@@ -233,6 +233,8 @@
#ifdef HOMEDIR
struct passwd *p;
+#if defined(_REENTRANT) && defined(HAVE_GETPWNAM_R)
struct passwd pwbuf;
char buf[1024];
+#endif
char userhome[MAX_FILENAME_LENGTH];
#endif
@@ -245,6 +247,10 @@
#ifdef HOMEDIR
+#if defined(_REENTRANT) && defined(HAVE_GETPWNAM_R)
if (getpwnam_r(filename, &pwbuf, buf, sizeof(buf), &p))
p = NULL;
+#else
+ p = getpwnam(filename);
+#endif
if (p == NULL)
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates