Release bumped to "gts4".
[tac_plus.git] / db_null.c
1 /*
2 **  Simple NULL driver for database interface. I created this for testing
3 **  db_* on my notebook by home. There i dont have Oracle or any database
4 **  server.                                               Fil/27-nov-1998
5 **
6 **  DO_NOT_USE_THIS_FOR_WORK!
7 */
8
9
10 #include "tac_plus.h"
11
12 #if defined(DB_NULL) && defined(DB)
13
14 #include "db_null.h"
15 #include "report.h"
16 #include "main.h"
17
18
19 int null_db_verify TAC_ARGS((const char *user, const char *users_passwd, const char *db_user, const char *db_password, const char *db_hostname, const char *db_table, const char *dbfield_name, const char *dbfield_passwd));
20
21 int null_db_verify(user, users_passwd, db_user, db_password, db_hostname,
22             db_table, dbfield_name, dbfield_passwd)
23 const char *user;                       /* username ... */
24 const char *users_passwd;               /* ... and given password */
25 const char *db_user;                    /* db's parametr's */
26 const char *db_password;
27 const char *db_hostname;
28 const char *db_table;
29 const char *dbfield_name;
30 const char *dbfield_passwd;
31 {
32 /*    report(LOG_DEBUG, "DB_NULL(%u) - ok", __LINE__); */
33
34     /* Try to verify the password
35        Successful if username and password equal */
36     if (strcmp(user, users_passwd)) {
37         return (0);
38     }
39     if (debug & DEBUG_PASSWD_FLAG)
40         report(LOG_DEBUG, "DB Null: verify password '%s'", users_passwd);
41
42     return (1); /* Return 1 if verified, 0 otherwise. */
43 }
44
45 /*      Null Database Accounting        */
46
47 int null_db_acct TAC_ARGS((const char *db_user, const char *db_password, const char *db_hostname, const char *db_name, const char *db_table, const char *s_name, const char *c_name, const char *a_username, const char *elapsed_time, const char *bytes_in, const char *bytes_out));
48
49 int
50 null_db_acct(db_user, db_password, db_hostname,db_name,db_table,s_name,c_name,a_username,elapsed_time,bytes_in,bytes_out)
51 const char *db_user;                    /* db's parametr's               */
52 const char *db_password;
53 const char *db_hostname;
54 const char *db_name;
55 const char *db_table;
56 const char *s_name;
57 const char *c_name;
58 const char *a_username;
59 const char *elapsed_time;
60 const char *bytes_in;
61 const char *bytes_out;
62 {
63     report(LOG_INFO,"Db accounting user=%s pass=%s host=%s \
64     db_name=%s table=%s servern=%s clientn=%s username=%s et=%s bi=%s bo=%s",db_user,db_password,db_hostname,
65     db_name,db_table,s_name,c_name,a_username,elapsed_time,bytes_in,bytes_out);
66     return (1);
67 }
68
69 #else /* defined(DB_NULL) && defined(DB) */
70
71 TAC_SOURCEFILE_EMPTY
72
73 #endif /* defined(DB_NULL) && defined(DB) */