summaryrefslogtreecommitdiffstats
path: root/lib/libadmin/authdb.c
blob: b8385d81f25c722513541566dce642fa2c1a2cb0 (plain)
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
/** BEGIN COPYRIGHT BLOCK
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 * Copyright (C) 2005 Red Hat, Inc.
 * All rights reserved.
 * END COPYRIGHT BLOCK **/
/* 
 * authdb.c:  Functions to aid in user/group database admin
 *            
 * These things leak memory like a sieve.  
 *            
 * Ben Polk
 *    (blame Mike McCool for functions with an MLM)
 */

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include "netsite.h"

/* Get the userdb directory. (V1.x) */
NSAPI_PUBLIC char *get_userdb_dir(void)
{
    char *userdb;
    char line[BIG_LINE];

#ifdef USE_ADMSERV
    char *tmp = getenv("NETSITE_ROOT");
    
    sprintf(line, "%s%cuserdb", tmp, FILE_PATHSEP);
#else
    char *tmp = get_mag_var("#ServerRoot");
    
    sprintf(line, "%s%cadmin%cuserdb", tmp, FILE_PATHSEP, FILE_PATHSEP);
#endif
    userdb = STRDUP(line);
    return userdb;
}