File: lookup-tester.c

package info (click to toggle)
socks4-server 4.3.beta2-20
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,512 kB
  • ctags: 1,778
  • sloc: ansic: 19,305; makefile: 399; sh: 52
file content (57 lines) | stat: -rw-r--r-- 1,162 bytes parent folder | download | duplicates (13)
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
53
54
55
56
57
/*
** lookup-tester.c	Tests the high-level ident calls.
**
** Author: P�r Emanuelsson <pell@lysator.liu.se>, 28 March 1993
*/

#include <stdio.h>
#include <sys/types.h>
#include <errno.h>

#include "ident.h"

main(argc,argv)
  int argc;
  char *argv[];
{
  IDENT *ident;
  char *user;

  chdir("/tmp");

  puts("Welcome to the other IDENT server tester, version 1.0\r\n\r");  

  puts("Testing ident_lookup...\r\n\r");
  fflush(stdout);

  ident = ident_lookup(fileno(stdin), 30);

  if (!ident)
    perror("ident");
  else {
    printf("IDENT response is:\r\n");
    printf("   Lport........ %d\r\n", ident->lport);
    printf("   Fport........ %d\r\n", ident->fport);
    printf("   Opsys........ %s\r\n", ident->opsys);
    printf("   Charset...... %s\r\n",
	   ident->charset ? ident->charset : "<not specified>");
    printf("   Identifier... %s\r\n", ident->identifier);
  }

  ident_free(ident);

  puts("\r\nTesting ident_id...\r\n\r");
  fflush(stdout);

  user = ident_id(fileno(stdin), 30);

  if (user)
    printf("IDENT response is identifier = %s\r\n", user);
  else
    puts("IDENT lookup failed!\r");

  fflush(stdout);
  sleep(1);
  exit(0);
}