pidentd  3.0.19
About: implementation of the RFC1413 identification server (more or less complete rewrite compared to version 2)
  Fossies Dox: pidentd-3.0.19.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

k_dummy.c
Go to the documentation of this file.
1 /*
2 ** k_dummy.c - A dummy (demonstration) kernel access module
3 **
4 ** Copyright (c) 1997 Peter Eriksson <pen@lysator.liu.se>
5 **
6 ** This program is free software; you can redistribute it and/or
7 ** modify it as you wish - as long as you don't claim that you wrote
8 ** it.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 */
14 
15 #include "config.h"
16 
17 #include <stdio.h>
18 
19 #include "pidentd.h"
20 
21 /*
22 ** ka_init should verify that the binary is running on a
23 ** supported OS version (in most cases it should verify
24 ** that it is running on exactly the same version as it was
25 ** compiled on).
26 */
27 int
28 ka_init(void)
29 {
30  char osinfo_current[256];
31 
32  if (osinfo_get(osinfo_current) == NULL)
33  return -1;
34 
35  return strcmp(osinfo_build, osinfo_current);
36 }
37 
38 
39 
40 /*
41 ** ka_open should open any kernel file descriptors or other
42 ** resources needed to access it, put it into some dynamically
43 ** allocated structure and store it into the 'misc' pointer.
44 **
45 ** It should return 0 if all was OK, else -1
46 */
47 int
48 ka_open(void **misc)
49 {
50  *misc = NULL;
51  return 0;
52 }
53 
54 
55 
56 /*
57 ** ka_lookup gets called when a request thread wants to
58 ** do a kernel lookup.
59 **
60 ** The pointer returned from ka_init() is passed as the "vp" parameter.
61 ** The local and remote address and port is available in the "kp"
62 ** parameter.
63 **
64 ** The function should set both the effective uid and real uid (if
65 ** either one isn't available, return -1 in that return variable)
66 ** variables in the "struct kernel" argument.
67 **
68 ** This function should return a 1 if the lookup was successful,
69 ** a zero if the connection wasn't found or a -1 in case an error
70 ** occured (the call to ka_lookup() will be retried if -1
71 ** is returned a configurable number of times, but will fail
72 ** immediately in case of a 0).
73 */
74 int
75 ka_lookup(void *vp, struct kernel *kp)
76 {
77  kp->euid = 12;
78  kp->ruid = 121;
79 
80  return 1;
81 }
ka_lookup
int ka_lookup(void *vp, struct kernel *kp)
Definition: k_dummy.c:75
pidentd.h
kernel::euid
uid_t euid
Definition: kernel.h:35
osinfo_get
char * osinfo_get(char *buf)
Definition: support.c:39
kernel::ruid
uid_t ruid
Definition: kernel.h:36
ka_open
int ka_open(void **misc)
Definition: k_dummy.c:48
ka_init
int ka_init(void)
Definition: k_dummy.c:28
osinfo_build
char osinfo_build[]
kernel
Definition: kernel.h:25