File: authmodfail.c

package info (click to toggle)
courier 0.47-4sarge5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 32,680 kB
  • ctags: 12,265
  • sloc: ansic: 164,045; cpp: 23,863; sh: 19,569; perl: 7,225; makefile: 4,192; yacc: 316; sed: 16
file content (52 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
** distribution information.
*/

#include	"auth.h"
#include	"authmod.h"
#include	<stdio.h>
#include	<string.h>
#include	<stdlib.h>
#include	<signal.h>
#if	HAVE_UNISTD_H
#include	<unistd.h>
#endif

static const char rcsid[]="$Id: authmodfail.c,v 1.4 1999/12/20 03:10:53 mrsam Exp $";

void	authmod_fail_completely()
{
char	**argv;
int	argc, n;
const char *p=getenv("AUTHARGC");
char	buf[20];

	if (!p || sscanf(p, "%d", &argc) <= 0 || argc <= 0)
	{
		write(2, "AUTHFAILURE\n", 12);
		authexit(1);
	}

	if ((argv=(char **)malloc((argc+1)*sizeof(char *))) == 0)
	{
		perror("malloc");
		authexit(1);
	}

	for (n=0; n<argc; n++)
	{
		sprintf(buf, "AUTHARGV%d", n);
		if ((argv[n]=getenv(buf)) == 0)
			authexit(1);
	}
	argv[n]=0;

	p=getenv("AUTHUSER");
	if (!p)
		authexit(1);

	execv(p, argv);
	perror(p);
	authexit(1);
}