Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 67060 | Differences between
and this patch

Collapse All | Expand All

(-)smbpwman-0.5.orig/smbpwman.c (-3 / +7 lines)
Lines 43-48 Link Here
43
 *   Expire cached passwords after short timeout
43
 *   Expire cached passwords after short timeout
44
 *   Add flush and flushall requests
44
 *   Add flush and flushall requests
45
 *   Rename shared functions to avoid naming collisions
45
 *   Rename shared functions to avoid naming collisions
46
 *   Hold server pid file lock until shutdown
46
 * Patched by Chris Jensen - 19 Aug 2004
47
 * Patched by Chris Jensen - 19 Aug 2004
47
 *   Clear passwords after first use
48
 *   Clear passwords after first use
48
 *   Overwrite passwords with 0x00 before freeing memory
49
 *   Overwrite passwords with 0x00 before freeing memory
Lines 60-65 Link Here
60
#include <stdarg.h>
61
#include <stdarg.h>
61
#include <syslog.h>
62
#include <syslog.h>
62
#include <time.h>
63
#include <time.h>
64
#include <sys/file.h>
63
65
64
/* Reference counter is necissary otherwise
66
/* Reference counter is necissary otherwise
65
 * the sequence store, store, retrieve, retrieve
67
 * the sequence store, store, retrieve, retrieve
Lines 245-250 Link Here
245
	char result;
247
	char result;
246
	int verbose = 0;
248
	int verbose = 0;
247
	FILE *lock;
249
	FILE *lock;
250
	int lock_result;
248
	pid_t cpid;
251
	pid_t cpid;
249
252
250
	// verify that the socket path is secure...
253
	// verify that the socket path is secure...
Lines 258-264 Link Here
258
	// create the lock file to make sure that this is the only process running...
261
	// create the lock file to make sure that this is the only process running...
259
	umask(0077);
262
	umask(0077);
260
	lock = fopen(PID_NAME, "w");
263
	lock = fopen(PID_NAME, "w");
261
	if(lock == NULL)
264
	lock_result = flock(fileno(lock), LOCK_EX | LOCK_NB);
265
	if((lock == NULL) || (lock_result == -1))
262
	{
266
	{
263
		print_version();
267
		print_version();
264
		fprintf(stderr, "Could not write lock file.  Is daemon already running?\n");
268
		fprintf(stderr, "Could not write lock file.  Is daemon already running?\n");
Lines 301-308 Link Here
301
305
302
	fprintf(lock, "%d\n", getpid());
306
	fprintf(lock, "%d\n", getpid());
303
307
304
	fclose(lock);
305
306
	if (!verbose)
308
	if (!verbose)
307
	{
309
	{
308
		close(0);
310
		close(0);
Lines 392-397 Link Here
392
				}
394
				}
393
				log(LOG_INFO, "shutdown request.  daemon terminating\n");
395
				log(LOG_INFO, "shutdown request.  daemon terminating\n");
394
				cache_flush(1);
396
				cache_flush(1);
397
				fclose(lock);
398
				remove(PID_NAME);
395
				return 0;
399
				return 0;
396
				break;
400
				break;
397
#ifdef DEBUG
401
#ifdef DEBUG

Return to bug 67060