File: sockd_getspcmd.c

package info (click to toggle)
socks4-server 4.3.beta2-13
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,512 kB
  • ctags: 1,778
  • sloc: ansic: 19,305; makefile: 404; sh: 52
file content (39 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (9)
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
/* sockd_getspcmd */

/* >>> Chee-Wai Yeung */
#ifndef NULL
#define NULL	0L
#endif
/* <<< Chee-Wai Yeung */
#include "socks.h"

int sockd_getspcmd(cfAddr, Ncf, no_identd_cmd, bad_id_cmd)
struct config *cfAddr;
int Ncf;
char **no_identd_cmd, **bad_id_cmd;
{
	int i;
	struct config *cp;
	int flags = 0;

#define HAS_NIC 1
#define HAS_BIC 2
#define HAS_BOTH 3

	*no_identd_cmd = NULL;
	*bad_id_cmd = NULL;

	for (i = 0, cp = cfAddr; i++ < Ncf; cp++) {
		if ((cp->action == BAD_ID) && ((flags & HAS_BIC) == 0)) {
			*bad_id_cmd = cp->cmdp;
			if ((flags |= HAS_BIC) == HAS_BOTH)
				return;
		}
		if ((cp->action == NO_IDENTD) && ((flags & HAS_NIC) == 0)) {
			*no_identd_cmd = cp->cmdp;
			if ((flags |= HAS_NIC)== HAS_BOTH)
				return;
		}
	}
}