[Fedora-directory-commits] adminserver/include/libadmin install.h, 1.3, 1.4 libadmin.h, 1.6, 1.7

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Wed May 9 00:26:37 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/adminserver/include/libadmin
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32253/adminserver/include/libadmin

Modified Files:
	install.h libadmin.h 
Log Message:
Resolves: bug 239502, bug 186280
Description: adminserver: autotools, FHS, clean up CGI parameters
Fix Description: Too numerous to mention




Index: install.h
===================================================================
RCS file: /cvs/dirsec/adminserver/include/libadmin/install.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- install.h	18 Aug 2005 19:15:28 -0000	1.3
+++ install.h	9 May 2007 00:26:35 -0000	1.4
@@ -31,152 +31,20 @@
 
 #include <stdio.h>  /* FILE struct */
 
-/* Provided by the admin server */
-#define CONFIG_DIRECTORY getenv("ADMSERV_ROOT")
-#define INSTALL_DIRECTORY getenv("NETSITE_ROOT")
-#define DEFAULT_ADMCONF "admserv.conf"
-
-/* For error page */
-#define INSTERR_PAGE "insterr.html"
-
-/* For myprintf() function, used in installation finish programs */
-#define MAX_PRINTF 1024
-
-/* Buffer for pathnames. This is way overallocated. */
-#define PATH_SIZE 1024
-
-
-/* Mode for new files */
-#define NEWDIR_MODE 0755
-#define NEWFILE_MODE 0644
-#define NEWSCRIPT_MODE 0755
-
-
-/* ------------ Output macros for installation finish programs ------------ */
-
-
-/* Global to say whether interactive refresh should be used or not */
-extern int interactive;
-/* Used to tell libadmin that we're upgrading */
-extern int upgrading;
-
-#define OUT(str) (write(fileno(stdout), buf, strlen(buf)))
-
-#ifdef XP_UNIX
-#define END_DOCUMENT() \
-{\
-  if(interactive) { \
-    myprintf("--THIS_STRING_NEVER_HAPPENS--\n"); \
-    sleep(1); \
-  } \
-}
-#else /* XP_WIN32 */
-#define END_DOCUMENT() \
-{\
-  if(interactive) { \
-    myprintf("--THIS_STRING_NEVER_HAPPENS--\n"); \
-	Sleep(1000); \
-  } \
-}
-#endif /* XP_WIN32 */
-
-#define START_DOCUMENT() \
-{\
-  if(interactive) \
-    myprintf("Content-type: text/html\n\n"); \
-}
-
-#define NEW_DOCUMENT() {END_DOCUMENT(); START_DOCUMENT(); }
-
-
-
 /* ------------------------------- Globals -------------------------------- */
 
 
 /* ------------------------------ Structures ------------------------------ */
 
 
-struct admconf {
-    char *adminuser;
-    char *password;
-    char *hosts;
-    char *addresses;
-
-    char *admport;
-    char *admuser;
-
-    char **lines;
-};
-
-
 /* -------------------------------- Macros -------------------------------- */
 
 
-/* You know, with a simple change, "cpp" can spell "crap". */
-#define STR2BOOL(str) (((str) && (!strcasecmp(str, "on"))) ? 1 : 0)
-#define BOOL2STR(x)   ((x) ? "on" : "off")
-
-#define TEXTINPUT(html, str, var) \
-  {if(directive_is(line, html)) { \
-     output_input("text", str, (var), "size=40"); \
-     continue; \
-  }}
-#define PASSINPUT(html, str, var) \
-  {if(directive_is(line, html)) { \
-     output_input("password", str, (var), "size=40"); \
-     continue; \
-  }}
-#define RADIOINPUT(htmloff, htmlon, str, var) \
-  {if(directive_is(line, htmloff)) { \
-     output_input("radio", str, "0", (var) ? NULL : "checked"); \
-     continue; \
-   } \
-   else if(directive_is(line, htmlon)) { \
-     fprintf(stdout, "<hr width=80%%>"); \
-     output_input("radio", str, "1", (var) ? "checked" : NULL); \
-     continue; \
-   }}
-#define CHECKBOXINPUT(html, str, var) \
-  {if(directive_is(line, html)) { \
-     output_input("checkbox", str, "1", (var) ? "checked" : NULL); \
-     continue; \
-  }}
-#define OUTPUT(html, str, var) \
-  {if(directive_is(line, html)) { \
-     fputs("The server ", stdout); \
-     printf(str, var); \
-     fputs(".<br>\n", stdout); \
-     continue; \
-  }}
-#define BINOUT(html, str, var, offstr, onstr) \
-  {if(directive_is(line, html)) { \
-     printf(str, ((!(var) || strcmp((var), "on")) ? offstr : onstr)); \
-     fputs(".<br>\n", stdout); \
-     continue; \
-  }}
-
-
 /* ------------------------------ Prototypes ------------------------------ */
 
 NSPR_BEGIN_EXTERN_C
 
-/* Functions used by installation finish programs */
-NSAPI_PUBLIC void install_finish_error(char *errpage, char *msg, char *buf);
-NSAPI_PUBLIC void myprintf(char *fmt, ...);
-NSAPI_PUBLIC void die(char *page, char *msg, char *info, ...);
-NSAPI_PUBLIC void create_subdirs(char *dir, char *page);
-NSAPI_PUBLIC void copy_file(char *sfile, char *dfile, int mode);
-NSAPI_PUBLIC void copy_dir(char *sdir, char *ddir, int sl, int dl);
-NSAPI_PUBLIC void run_server(char *cmd, FILE *html);
-
-NSAPI_PUBLIC void install_killadm(void);
-NSAPI_PUBLIC void install_checkport(char *addr, char *port);
-NSAPI_PUBLIC void install_checkuser(char *user);
-NSAPI_PUBLIC int try_bind(char *addr, int port);
-
-NSAPI_PUBLIC struct admconf *admconf_create(void);
-NSAPI_PUBLIC void admconf_write(struct admconf *sc, char *fn);
-NSAPI_PUBLIC struct admconf *admconf_scan(char *filename);
+int try_bind(char *addr, int port);
 
 NSPR_END_EXTERN_C
 


Index: libadmin.h
===================================================================
RCS file: /cvs/dirsec/adminserver/include/libadmin/libadmin.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- libadmin.h	10 Oct 2006 19:56:30 -0000	1.6
+++ libadmin.h	9 May 2007 00:26:35 -0000	1.7
@@ -46,87 +46,8 @@
 
 #undef howmany
 
-#define ADM_CONF "admin.conf"
-#define MAGNUS_CONF "magnus.conf"
-#define OBJ_DATABASE "obj.conf"
-#define MIME_TYPES "mime.types"
-#define NSADMIN_CONF "adm.conf"
-#define CERT_LOG "cert.log"
-
-#define SERVER_KEY_NAME "Server-Key"
-#define SERVER_CERT_NAME "Server-Cert"
-
-#define DBPW_USER "admin"
-#define DB_BAD_INPUT_CHARS "<>\""
-#define AUTHDB_ACL_FAIL -1
-#define AUTHDB_ACL_ODD_ACL -2
-#define AUTHDB_ACL_NOT_FOUND -3
-
-#define ACLNAME_READ_COOKIE "formgen-READ-ACL"
-#define ACLNAME_WRITE_COOKIE "formgen-WRITE-ACL"
-
-#define USERNAME_KEYWORD "USERNAME"
-
-typedef struct authInfo_s authInfo_t;
-struct authInfo_s {
-    char *type;
-    char *db_path;
-    char *prompt;
-};  
-
-/* Not defined in any nspr header file, why? */
-PRNetAddr *PR_CreateNetAddr(int PR_IpAddrNull, PRUint16 port);
-
 NSPR_BEGIN_EXTERN_C
 
-NSAPI_PUBLIC char *get_ip_and_mask(char *candidate);   
-NSAPI_PUBLIC int groupOrUser(char *dbname, char *name,
-			     int *is_user, int *is_group); 
-NSAPI_PUBLIC int is_readacl(char *name);
-NSAPI_PUBLIC int is_writeacl(char *name);
-NSAPI_PUBLIC char *get_acl_file(void); /* Full path to file used by server. */
-NSAPI_PUBLIC char *get_workacl_file(void); /* Full path to file updated by ACL forms. */
-NSAPI_PUBLIC int get_acl_names(char **readaclname,
-			       char **writeaclname, char *dir);
-NSAPI_PUBLIC int get_acl_info(char *acl_file, char *acl_name,
-			      void **acl_context, char ***hosts,
-			      authInfo_t **authinfo,
-			      char ***users, char ***userhosts,
-			      int *fdefaultallow);
-NSAPI_PUBLIC int set_acl_info(char *acl_file, char *acl_name, int prefix,
-			      void **pacl, char **rights,
-			      char **hosts, authInfo_t *authinfo,
-			      char **users, char **userhosts,
-			      int fdefaultallow);
-NSAPI_PUBLIC int delete_acl_by_name(char *acl_file, char *acl_name);
-
-NSAPI_PUBLIC int str_flag_to_int(char *str_flag); 
-NSAPI_PUBLIC int admin_is_ipaddr(char *p);
-NSAPI_PUBLIC void get_hostnames_and_ipaddrs(char **hosts,
-					    char **hostnames, char **ipaddrs);
-NSAPI_PUBLIC void load_host_array(char ***hosts,
-				  char *hostnames, char *ipaddrs);
-NSAPI_PUBLIC void load_users_array(char ***users,
-				   char *usernames, char *groups);
-NSAPI_PUBLIC void get_users_and_groups(char **users, char **usernames,
-				       char **groups, char *dbname);  
-NSAPI_PUBLIC char * str_unquote(char * str);
-
-extern NSAPI_PUBLIC char *acl_read_rights[];
-extern NSAPI_PUBLIC char *acl_write_rights[];
-
-#ifdef USE_ADMSERV
-#define CONFDIR(x) get_conf_dir(x)
-#define ACLDIR(x) get_acl_dir(x)
-#define COMMDEST(x) get_commit_dest(x)
-#define SERVER_NAMES getenv("SERVER_NAMES")
-#define ADMCONFDIR getenv("ADMSERV_ROOT")
-#else
-#define ACLDIR(x) "../../httpacl/"
-#define CONFDIR(x) "../config/"
-#define ADMCONFDIR "../config/"
-#endif
-
 #ifdef XP_UNIX
 #define FILE_PATHSEP '/'
 #define OPEN_MODE "r"
@@ -208,9 +129,6 @@
 #define DEFAULT_ERROR 3
 
 /* The change types for admin logging */
-#define TO_MAGNUS "magnus.conf"
-#define TO_OBJCONF "obj.conf"
-#define TO_ACLFILE "generated.acl"
 #define TO_STATUS "status"
 #define TO_ADMIN "admserv"
 #define TO_USERDB "userdb"
@@ -233,31 +151,6 @@
 /* Need also a way to identify the backup files when we're doing an ls */
 #define BACKUP_SHORT ".v"
 
-/* User database defines */
-#define IS_A_DBM 1
-#define IS_A_NCSA 2
-
-#define REMOVE_FROM_DB "-REMOVE_THIS_USER"
-#define DB_INC "inc"
-#define NCSA_EXT "pwf"
-
-/* We now use the client DB libs, so they're all '.db' with no second file. */
-#define DBM_EXT_1 "db"
-#define DBM_EXT_2 NULL
-
-/* Define the functions in a central place so that obj.conf viewer can get 
- * to them */
-#ifdef MCC_PROXY
-#define BASIC_NCSA_FN   "proxy-auth"
-#define REQUIRE_AUTH_FN "require-proxy-auth"
-#define CHECK_ACL_FN  "check-acl"
-#else
-#define BASIC_NCSA_FN   "basic-ncsa"
-#define REQUIRE_AUTH_FN "require-auth"
-#define CHECK_ACL_FN  "check-acl"
-#endif
-
-
 /* Frame window names. */
 #define INDEX_NAME "index"
 #define MESSAGE_NAME "msgs"
@@ -271,11 +164,6 @@
 #define INFO_TOPIC_NAME "infotopic"
 #define HELP_WIN_OPTIONS "'scrollbars=yes,resizable=1,width=500,height=500'"
 
-
-/* pblock types, either it's a ppath, or it's a name. */
-#define PB_NAME 1
-#define PB_PATH 2
-
 /* Resource types */
 #define NAME "name"
 #define FILE_OR_DIR "path"
@@ -341,10 +229,6 @@
 #include "la_msgs.i"
 #include "hadm_msgs.i"
  
-/* Initialize libadmin.  Should be called by EVERY CGI. */
-/* util.c */
-NSAPI_PUBLIC int ADM_Init(void);
-
 /* Open a .html file to parse it.  Returns a file ptr (simple fn, really) */
 /* error one doesn't call report_error so we lose the infinite loop prob */
 /* form_get.c */
@@ -379,16 +263,6 @@
 /* referer.c */
 NSAPI_PUBLIC char *get_referer(char **config);
 
-/* Set the referer and write out the config file */
-/* referer.c */
-NSAPI_PUBLIC void set_referer(char **config);
-
-/* Sets the referer to a script that's not you.  If new_ref is an absolute ref,
- * it will cat that with SERVER_URL; if it's not, it will replace the
- * current script name with new_ref. */
-/* referer.c */
-NSAPI_PUBLIC void set_fake_referer(char *new_ref);
-
 /* Redirect the person to the Referer, or give a short error message */
 /* referer.c */
 NSAPI_PUBLIC void redirect_to_referer(char *addition);
@@ -431,188 +305,7 @@
 NSAPI_PUBLIC void output_alert(int type, char *info, char *details, int wait);
 NSAPI_PUBLIC void report_error(int type, char *info, char *details);
 NSAPI_PUBLIC void report_warning(int type, char *info, char *details);
-
-/* Read the administrative config from the server admin root */
-/* Mult adm gets a particular adm config (for multiple server config) */
-/* admconf.c */
-NSAPI_PUBLIC char **get_adm_config(void);
-NSAPI_PUBLIC char **get_mult_adm_config(int whichone);
-
-/* Write the administrative config back to the file */
-/* Mult adm saves a particular adm config (for multiple server config) */
-/* admconf.c */
-NSAPI_PUBLIC int write_adm_config(char **config);
-NSAPI_PUBLIC int write_mult_adm_config(int whichone, char **config);
-
-/* An additional level of abstraction for resource grabbing.  Gets the current
- * resource from the config set. */
-/* admconf.c */
-NSAPI_PUBLIC char *get_current_resource(char **config);
-
-/* Gets the string of the current resource type */
-/* admconf.c */
-NSAPI_PUBLIC char *get_current_typestr(char **config);
-
-/* Gets the pblock type of the current resource from the config set. */
-/* admconf.c */
-NSAPI_PUBLIC int get_current_restype(char **config);
-
-/* Sets the current resource given its type and its data. */
-/* admconf.c */
-NSAPI_PUBLIC void set_current_resource(char **config, char *nrestype, char *nres);
-
-
-/* Get the value of a particular variable in magnus.conf */
-/* get_num_mag_var: get only a particular server's value for it */
-/* magconf.c */
-NSAPI_PUBLIC char *get_mag_var(char *var);
-NSAPI_PUBLIC char *get_num_mag_var(int whichsrv, char *var);
-
-/* Set the value of a particular variable in magnus.conf */
-/* magconf.c */
-NSAPI_PUBLIC void set_mag_var(char *name, char *value);
-
-/* Get the value of a particular variable in cert.log */
-NSAPI_PUBLIC char *get_cert_var(char *var);
-NSAPI_PUBLIC char *get_num_cert_var(int whichsrv, char *var);
-
-/* Set the value of a particular variable in cert.log */
-NSAPI_PUBLIC void set_cert_var(char *name, char *value);
-
-/* Get the value of a particular variable in adm.conf */
-/* admserv.c */
-NSAPI_PUBLIC char *get_nsadm_var(char *var);
-NSAPI_PUBLIC char **scan_server_instance(char *, char **);
-
-
-/* Set the value of a particular variable in adm.conf */
-/* admserv.c */
-NSAPI_PUBLIC void set_nsadm_var(char *name, char *value);
-
-/* List all of the installed servers on the admin server.  */
-/* Takes 1 arg (string list of identifiers for servers, such as */
-/* httpd, https, proxy, news) */
-/* admserv.c */
-NSAPI_PUBLIC char **list_installed_servers(char **namelist);
-
-/* Reads in the list of servers installed on this machine.  Fills in 
- * two string lists (one of names, one of descriptions.)  *servlist and
- * *desclist will be allocated for you. */
-NSAPI_PUBLIC void read_server_lst(char ***namelist, char ***desclist);
-NSAPI_PUBLIC void read_keyalias_lst(char ***namelist);
-NSAPI_PUBLIC void read_certalias_lst(char ***namelist);
-NSAPI_PUBLIC void get_key_cert_files(char *alias, char **keyfile, char **certfile);
-NSAPI_PUBLIC void display_aliases(char *keyfile, char **aliaslist);
-
-/* Commit all outstanding config stuff from admin directory to the actual
- * server.  Does not restart the server. */
-/* Argument authlist is a string list of authorization strings 
- * (username:password) to send to remote servers (or NULL if it is a 
- * local machine.) */
-/* commit.c */
-NSAPI_PUBLIC int do_commit(char **authlist);
-
-/* Back out from outstanding changes. Authlist same as above. */
-/* commit.c */
-NSAPI_PUBLIC int do_undo(char **authlist);
-
-/*  Prints outstanding changes to server to stdout. */
-/* commit.c */
-NSAPI_PUBLIC void output_uncommitted(void);
-
-/* Returns a flag saying whether there are outstanding changes that need to
- * be committed.  If you've already read in admin.conf, send a pointer to 
- * it here.  Or else send NULL, and it'll read it in.  */
-/* commit.c */
-NSAPI_PUBLIC int needs_commit(char **config);
-
-/* Sets the flag to say whether we need to commit or not.  1 means "yes,
- * we need to commit."  0 means "No, I just committed the changes." 
- * whichsrv is which server to set the bit in (if you're configuring 
- * multiple servers.) */
-/* commit.c */
-NSAPI_PUBLIC void set_commit(int whichsrv, int needscommit);
-
-/* Returns an int for which backup number to use. 0=magnus, 1=obj*/
-/* index is which server among the list you want to use (mult config) */
-/* commit.c */
-NSAPI_PUBLIC int get_bknum(int which, int index);
-
-/* Sets the current backup number. */
-/* index is which server among the list you want to use. */
-/* commit.c */
-NSAPI_PUBLIC void set_bknum(int num, int which, int index);
-
-/* Backs up given file, using number in admconf. */
-/* commit.c */
-NSAPI_PUBLIC void conf_backup(char *whichfile, int index, int whichsrv);
-
-/* Gets the last known modification time for a config file.  
- * When you do a commit, this is set to the mod time after you do
- * the commit.  Later, when you want to see if the file you're about
- * to upload has changed, you check this value. */
-/* commit.c */
-NSAPI_PUBLIC time_t get_org_mtime(int whichsrv, int whichfile);
-
-/* Gets and sets the three modification times as they were stored in 
- * admin.conf. */
-/* Useful in remote transactions. */
-/* commit.c */
-NSAPI_PUBLIC char *get_mtime_str(int whichsrv);
-NSAPI_PUBLIC void set_mtime_str(int whichsrv, char *str);
-
-/* Sets that same value (see above) */
-/* commit.c */
-NSAPI_PUBLIC void set_org_mtime(int whichsrv, int whichfile, time_t mtime);
-
-/* Set the modification times for *all* of the files needing this check,
- * assuming admin.conf got lost or hasn't been created yet. */
-/* When it doubt, set to zero. */
-NSAPI_PUBLIC void set_all_org_mtimes(void);
-
-
-/* Create an internal list of the servers which are being changed. */
-/* Returns the total number of servers in the list. */
-/* multconf.c */
-NSAPI_PUBLIC int make_conflist(void);
-
-/* Don't use this function.  It's a grotesque hack.  It's used by the admin
- * page to fake the on/off buttons for the servers. */
-/* multconf.c */
-NSAPI_PUBLIC int fake_conflist(char *fakename);
-
-/* Get the current admin config directory.  Takes an int to say which one
- * (of the list of servers to configure) you're interested in, so you can
- * for loop through them.  Always use 0 if you want the first one. */
-/* multconf.c */
-NSAPI_PUBLIC char *get_conf_dir(int whichone);
-NSAPI_PUBLIC char *get_alias_dir(void);
-NSAPI_PUBLIC void read_alias_files(char ***aliasfiles);
-NSAPI_PUBLIC void read_aliases(char ***aliaslist);
  
-/* Return 1 if this server number whichone is a not on the local machine. */
-/* multconf.c */
-NSAPI_PUBLIC int is_remote_server(int whichone);
-
-/* Return 1 if we are configuring the admin server. */
-/* multconf.c */
-NSAPI_PUBLIC int is_admserv(void);
-
-/* Return 1 if there is a remote server in the list of servers to config. */
-/* Return 0 if not. */
-/* multconf.c */
-NSAPI_PUBLIC int remote_server_inlist(void);
-
-/* Get the ultimate destination for a particular config file set.  Same 
- * arg as above function. */
-/* multconf.c */
-NSAPI_PUBLIC char *get_commit_dest(int whichone);
-
-/* Get the name of the indicated server (for logging purposes etc.) */
-/* Send -1 for a string with all of them. */
-/* multconf.c */
-NSAPI_PUBLIC char *get_srvname(int whichsrv);
-
 
 /* Some simple buffering tools */
 /* Keeps a buffer for network info, and a buffer for returning lines */
@@ -677,113 +370,6 @@
 /* admlog.c */
 NSAPI_PUBLIC void log_change(char *kind, char *change, ...);
 
-/* Get a pretty string for the current resource for logging. */
-/* admlog.c */
-NSAPI_PUBLIC char *log_curres(char **config);
-
-
-/* List all the user databases (actually, all files) in a given path into a 
- * strlist. */
-/* userdb.c */
-NSAPI_PUBLIC char **list_user_dbs(char *fullpath);
-
-NSAPI_PUBLIC char **list_auth_dbs(char *fullpath);
-
-/* Output the 1.x database selector.  Path is the path to the DB's, element is
- * the desired SELECT name, current is the one that should currently be
- * selected. */
-/* userdb.c */
-NSAPI_PUBLIC void output_db_selector(char *path, char *element, char *current);
-
-/* Output the 2.x database selector.  Path is the path to the DB's, element is
- * the desired SELECT name, current is the one that should currently be
- * selected. */
-NSAPI_PUBLIC void output_authdb_selector(char *path, char *element, char *current);
-
-/* Sets which DB is considered current. */
-/* userdb.c */
-NSAPI_PUBLIC void set_current_db(char *current); /* obsolete 1.x */
-
-/* Sets which DB is considered current (2.x version). */
-NSAPI_PUBLIC void set_current_authdb(char *current);
-NSAPI_PUBLIC char *get_current_authdb(void);
-
-/* Detect the type of the given database. */
-/* WARNING: REMOVES THE EXTENSION!!! */
-/* userdb.c */
-NSAPI_PUBLIC int detect_db_type(char *db_name);
-
-/* Find a user within an NCSA database, and return */
-/* userdb.c */
-NSAPI_PUBLIC char *find_user_ncsa(char *db, char *user);
-
-/* Add a user to an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC void add_user_ncsa(char *db, char *user, char *password, int enc);
-
-/* List all the users in an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC char **list_users_ncsa(char *db);
-
-/* Modify a user in an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC int modify_user_ncsa(char *db, char *user, char *pw);
-
-/* Verify the admin password, or die.  Returns 1 if there is one, 0 if not */
-/* userdb.c */
-NSAPI_PUBLIC int verify_adm_ncsa(char *db, char *pw);
-
-/* Remove a user from an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC int remove_user_ncsa(char *db, char *user);
-
-#ifdef XP_UNIX /* WIN32 has no DBM */
-/* Find a user within a DBM database, and return */
-/* userdb.c */
-char *find_user_dbm(char *db, char *user);
-
-/* Add a user to a DBM database */
-/* userdb.c */
-void add_user_dbm(char *db, char *user, char *password, int enc);
-
-/* List all the users in a DBM */
-/* userdb.c */
-char **list_users_dbm(char *db);
-
-/* Modify a user in a DBM database */
-/* userdb.c */
-int modify_user_dbm(char *db, char *user, char *pw);
-
-/* Verify the admin password, or die.  Returns 1 if there is one, 0 if not */
-/* userdb.c */
-int verify_adm_dbm(char *db, char *pw);
-
-/* Remove a user from a DBM */
-/* userdb.c */
-int remove_user_dbm(char *db, char *user);
-
-#endif /* WIN32 */
-
-
-/* Checks to see if server is running.  Doesn't work over network.  Returns 0
- * if it's down, 1 if it's up, -1 if an error occurred. */
-/* pcontrol.c */
-NSAPI_PUBLIC int is_server_running(int whichsrv);
-
-/* Starts up the HTTP server. Puts the errors into /tmp/startup.[pid] */
-/* Returns 0 on success, 1 on failure */
-/* Restart restarts it, shutdown shuts it down */
-/* pcontrol.c */
-NSAPI_PUBLIC int startup_http(int, char*, char *);
-NSAPI_PUBLIC int restart_http(int, char*, char *);
-NSAPI_PUBLIC int shutdown_http(int, char*);
-
-/* As above, but for SNMP HTTP subagent */
-/* pcontrol.c */
-NSAPI_PUBLIC int startup_snmp();
-NSAPI_PUBLIC int restart_snmp();
-NSAPI_PUBLIC int shutdown_snmp();
-
 /* Performs the request rq, for server (in list) whichsrv, using auth as
  * auth info.
  * 
@@ -822,12 +408,6 @@
 /* util.c */
 NSAPI_PUBLIC void ADM_remove_directory(char *path);
 
-#ifdef XP_UNIX
-/* Obtain Unix SuiteSpot user/group information */
-/* util.c */
-NSAPI_PUBLIC int ADM_GetUXSSid(char *, char **, char **);
-#endif
-
 /* Return: LastModificationTime(f1) < LastModificationTime(f2) ? */
 /* util.c */
 NSAPI_PUBLIC int mtime_is_earlier(char *file1, char *file2);
@@ -842,88 +422,6 @@
 /* Valid floating point number? */
 NSAPI_PUBLIC int all_numbers_float(char *target);
 
-/* Get the [ServerRoot]/config directory. */
-/* whichone is which server you're interested in.  */
-/* 0 if you want the first one.*/
-/* util.c */
-NSAPI_PUBLIC char *get_admcf_dir(int whichone);
-
-/* Get the admin server's [ServerRoot]/config directory */
-NSAPI_PUBLIC char *get_admservcf_dir(void);
-
-/* Get the admin/userdb directory. */
-/* util.c */
-NSAPI_PUBLIC char *get_userdb_dir(void);
-/* Get the V2.x admin/userdb directory. */
-/* util.c */
-NSAPI_PUBLIC char *get_authdb_dir(void);
-NSAPI_PUBLIC char *get_httpacl_dir(void);
-
-
-/* V2.x User admin functions.  They take a full path of
-   the directory where the databases live, and perform
-   various operations on the databases.  They open and
-   close the DBM, so they can not be called when the
-   database is already open.  The output_xxx ones spit
-   out various HTMLized admin data.
-*/
-NSAPI_PUBLIC int getfullname(char *dbname, char *user, char **fullname); 
-NSAPI_PUBLIC int setfullname(char *dbname, char *user, char *fullname);
-NSAPI_PUBLIC int setpw(char *dbname, char *user, char *pwd);
-NSAPI_PUBLIC int setdbpw(char *dbname, char *pwd);
-NSAPI_PUBLIC int checkdbpw(char *dbname, char *pwd);
-NSAPI_PUBLIC int addusertogroup(char *dbname, char *user, char *group);
-NSAPI_PUBLIC int remuserfromgroup(char *dbname, char *user, char *group);
-NSAPI_PUBLIC int addgrouptogroup(char *dbname, char *memgroup, char *group);
-NSAPI_PUBLIC int remgroupfromgroup(char *dbname, char *memgroup, char *group);
-NSAPI_PUBLIC int output_users_list(char *line, char *userfilter);
-NSAPI_PUBLIC int output_groups_list(char *dbname, char *groupfilter); 
-NSAPI_PUBLIC void output_group_membership(char *dbname, char *user);
-NSAPI_PUBLIC void output_nonmembership(char *dbname, char *user);
-NSAPI_PUBLIC void output_grpgroup_membership(char *dbname, char *group, char *filter);
-NSAPI_PUBLIC void output_user_membership(char *dbname, char *group, char *filter);
-NSAPI_PUBLIC void output_nongrpgroup_membership(char *dbname, char *group, char *filter);
-NSAPI_PUBLIC void output_nonuser_membership(char *dbname, char *group, char *filter);
-
-/* Set a user's login name */
-NSAPI_PUBLIC int setusername(char *db_path, char *user, char *newname);
-
-/* Output a selector box with name "name", an option "NONE" if none=1, 
- *  and make it a multiple selector box if multiple=1.  If multiple != 1, 
- *  then make it a pulldown list if the number of groups is less than 
- *  SELECT_OVERFLOW. */
-/* If highlight is non-null, specifically highlight that entry. */
-/* If user is non-null, and it's a multiple box, correctly set the group
- *  membership in the multiple list (Groups they're in are on, groups they're
- *  not in are off. */
-/* If group_user is one, then the variable "user" refers to *group* members,
- *  not *user* members. */
-/* If except is non-null, output all entries except the "except" item. */
-/* (note: this methodology is known as the "Garbage pail method", just 
- *  keep adding parameters till it does everything you want) MLM */
-#define SELECT_OVERFLOW 25
-NSAPI_PUBLIC void output_group_selector(char *db_path, 
-                                        int group_user, char *user,
-                                        char *highlight, char *except,
-                                        char *name, int none, int multiple);
-
-/* Same as above, except output a list of users, highlighting those in a
- * particular group.  MLM */
-NSAPI_PUBLIC void output_user_selector(char *db_path, char *group,
-                                       char *highlight, char *except,
-                                       char *name, int none, int multiple);
-
-/* Take a char ** null terminated list of group names, and change a user's
- * memberships so those are the only groups he's in.   MLM */
-NSAPI_PUBLIC void change_user_membership(char *db_path, char *user,
-                                         char **new_groups);
-
-/* Take a char ** null terminated list of group names, and change a user's
- * memberships so those are the only groups he's in.   MLM */
-/* If group_users is 1, then new_users are assumed to be groups. */
-NSAPI_PUBLIC void change_group_membership(char *db_path, char *group,
-                                          int group_users, char **new_users);
-
 
 /* Get the server's URL. */
 /* util.c */
@@ -995,199 +493,6 @@
 /* ns-util.c */
 NSAPI_PUBLIC int write_tech(char *fn, char **lines);
 
-/* Compares two passwords, one plaintext and one encrypted. Returns strcmp()
- * like integer (0 good, anything else bad) */
-/* password.c */
-NSAPI_PUBLIC int pw_cmp(const char *pw, const char *enc);
-
-/* Maintain what amounts to a handle to a list of strings */
-/* strlist.c */
-/* Moved to libadminutil, use libadminutil/admutil.h instead
-NSAPI_PUBLIC char **new_strlist(int size);
-NSAPI_PUBLIC char **grow_strlist(char **strlist, int newsize);
-NSAPI_PUBLIC void free_strlist(char **strlist);
-*/
-
-/* Handle INN config.data which are now called nsnews.conf files */
-/* nsnews.c */
-char *find_nsnews_var(char *var, char **lines);
-void set_nsnews_var(char *name, char *val, char **lines);
-int find_nsnews_line(char *var, char **lines);
-void remove_nsnews_var(char *name, char **lines);
-void replace_nsnews_prefix(char *opfx, char *npfx, char **lines);
-
-char **scan_nsnews_admin(char *filename);
-char **scan_nsnews_install(char *filename);
-void nsnews_file2path_admin(char *filename, char *path);
-void nsnews_file2path_install(char *filename, char *path);
-void write_nsnews_admin(char *filename, char **lines);
-void write_nsnews_install(char *filename, char **lines);
-
-void run_ctlinnd(char *cmd);
-char **nsnews_status(void);
-void set_moderator(char *group, char *email);
-char *find_moderator(char *group, char **lines);
-char **scan_active(char **nscnf);
-int find_active_group(char *grp, char **active);
-char *active_flags(char *line);
-int active_groupmatch(char *grppat, char *line);
-char **scan_expirectl(char *fn);
-void write_expirectl(char *fn, char **lines);
-void set_expire_remember(char *days, char **lines);
-void set_expire_default(char *def, char *keep, char *purge, char **lines);
-
-#define EXPREM_STRING "/remember/:"
-#define EXPREM_LEN 11
-#define EXPDEF_STRING "*:A:"
-#define EXPDEF_LEN 4
-
-#define find_expire_remember(lines) (find_expire_string(EXPREM_STRING, lines))
-#define find_expire_default(lines) (find_expire_string(EXPDEF_STRING, lines))
-char *find_expire_string(char *find, char **lines);
-
-typedef struct {
-    char *patterns;
-    char flag;
-    char *keep;
-    char *def;
-    char *purge;
-} expire_s;
-int expire_entry(char *line, expire_s *ret);
-expire_s *expire_entry_default(char **lines);
-expire_s *find_expire_entry(char *find, char **lines);
-void new_expire_entry(expire_s *ex, char **lines);
-void change_expire_entry(char *find, expire_s *ex, char **lines);
-void remove_expire_entry(char *find, char **lines);
-
-typedef struct {
-    char *grp;
-    char *hostpats;
-    char *flags;
-    char *userpat;
-} permission_s;
-char **scan_nsaccess(char *fn);
-void write_nsaccess(char *fn, char **lines);
-permission_s *find_nsaccess_default(char **lines);
-permission_s *find_nsaccess_entry(char *find, char **lines);
-void new_nsaccess_entry(permission_s *ps, char **lines);
-void change_nsaccess_entry(char *find, permission_s *ps, char **lines);
-void remove_nsaccess_entry(char *find, char **lines);
-
-/* Handle newsfeeds files */
-void feed_read_file();
-void feed_write_file();
-char *feed_get_ind_var(int *x);
-char *feed_get_host_var(char *host);
-char *feed_get_newsgroups(char *feedline);
-char *feed_get_param(char *feedline);
-void feed_split_newsgroups(char *ngroups, char **allow, char **deny);
-char *add_bangs(char *string);
-void compress_whitespace(char *source);
-char *feed_merge_newsgroups(char *allow_in, char *deny_in);
-void feed_set_groups(char *host, char *groups);
-void feed_set_entry(char *id, char *ngroups, char *feedtype, char *params);
-void feed_delete_host(char *host);
-void feed_dump_vars(char *feedtype, char *dest);
- 
-void nnhost_add(char *hostname);
-void nnhost_delete(char *hostname);
-
-void nnctl_add(char *hostname);
-void nnctl_delete(char *hostname);
-
-int nsnews_running(char **nscnf);
-
-
-#ifdef MCC_PROXY
-
-extern long inst_cache_size_tbl[];
-extern long inst_cache_capacity_tbl[];
-extern long cache_size_tbl[];
-extern long cache_capacity_tbl[];
-extern float lm_factor_tbl[];
-extern long time_interval_tbl[];
-extern long timeout_tbl[];
-extern int percent_tbl[];
-
-char *mb_str(long mb);
-char *lm_str(float f);
-
-void output_interval_select(char *name, char *other, long selected, long *tbl);
-void output_mb_select(char *name, char *other, long selected, long *tbl);
-void output_lm_select(char *name, char *other, float selected, float *tbl);
-void output_percentage_select(char *name, char *other, int selected, int *tbl);
-
-#endif /* MCC_PROXY */
-
-#ifdef MCC_NEWS
-
-char * get_active_news_authdb(char **nscnf);
-void set_active_news_authdb(char *name, char **nscnf);
-void output_active_news_authdb(char **nscnf);
-
-#endif /* MCC_NEWS */
-
-#if 0 /* move cron_conf to libadminutil    */
-
-/* read and write to cron.conf, cron_conf.c */
-/* Alex Feygin, 3/22/96                     */
-typedef struct cron_conf_obj
-{
-  char *name;
-  char *command;
-  char *dir;
-  char *user;
-  char *start_time;
-  char *days;
-} 
-cron_conf_obj;
- 
-typedef struct cron_conf_list
-{
-  char *name;
-  cron_conf_obj *obj;
-  struct cron_conf_list *next;
-} 
-cron_conf_list;
- 
-/* Reads cron.conf to a null terminated list of cron_conf_objects; returns
-   0 if unable to do a read; 1 otherwise */
-NSAPI_PUBLIC int cron_conf_read();
- 
-/* gets a cron object, NULL if it doesnt exist */
-NSAPI_PUBLIC cron_conf_obj *cron_conf_get(char *name);
- 
-/* returns a NULL-terminated cron_conf_list of all the cron conf objects */
-NSAPI_PUBLIC cron_conf_list *cron_conf_get_list();
- 
-/* Creates a cron conf object; all these args get STRDUP'd in the function
-   so make sure to free up the space later if need be */
-NSAPI_PUBLIC cron_conf_obj *cron_conf_create_obj(char *name, char *command,
-						 char *dir,  char *user, 
-						 char *start_time, char *days);
- 
-/* Puts a cron conf object into list or updates it if it already in there.
-   Returns either the object passed or the object in there already;
-   cco may be FREE'd during this operation so if you need the object
-   back, call it like so:
-   
-   cco = cron_conf_set(cco->name, cco);  
- 
-   calling cron_conf_set with a NULL cco will cause the 'name' object
-   to be deleted.
-*/
-NSAPI_PUBLIC cron_conf_obj *cron_conf_set(char *name, cron_conf_obj *cco);
- 
-/* write out current list of cron_conf_objects to cron.conf file */
-NSAPI_PUBLIC void cron_conf_write();
- 
-/* free all cron conf data structures */
-NSAPI_PUBLIC void cron_conf_free();
-
-
-#endif /* move cron_conf to libadminutil    */
-
-
 /**************************************************************************
  * This is should really be in base/file.h, but we don't want to tread on
  * toes.
@@ -1215,11 +520,56 @@
 
 /************************** Miscellaneous *************************/
 NSAPI_PUBLIC char * jsEscape(char *src);
-NSAPI_PUBLIC int read_AbbrDescType_file(char *path, char ***namelist, char ***desclist);
 
 NSAPI_PUBLIC void htmladmin_strcat_escaped( char *s1, char *s2 );
 NSAPI_PUBLIC char *htmladmin_strdup_escaped( char *s );
 
+/* returns true if the given path is a valid directory, false otherwise */
+NSAPI_PUBLIC int
+util_is_dir_ok(const char *path);
+
+/* returns true if the given path is a valid file, false otherwise */
+NSAPI_PUBLIC int
+util_is_file_ok(const char *path);
+
+/* returns true if the file was found somewhere, false otherwise */
+NSAPI_PUBLIC int
+util_find_file_in_paths(
+	char *filebuf, /* this will be filled in with the full path/filename if found, '\0' otherwise */
+	size_t bufsize, /* size of filebuf e.g. sizeof(filebuf) */
+	const char *filename, /* the base filename to look for */
+	const char *path, /* path given by caller */
+	const char *arpath, /* path relative to ADMSERV_ROOT */
+	const char *nrpath /* path relative to NETSITE_ROOT */
+);
+
+/* Get the path to the directory containing config files */
+NSAPI_PUBLIC const char*
+util_get_conf_dir(void);
+
+/* Get the path to the directory containing log files */
+NSAPI_PUBLIC const char*
+util_get_log_dir(void);
+
+/* Get the path to the directory containing html files */
+NSAPI_PUBLIC const char*
+util_get_html_dir(void);
+
+/* Get the path to the directory containing icon/image files */
+NSAPI_PUBLIC const char*
+util_get_icon_dir(void);
+
+/* make sure the given name looks like a good file name */
+NSAPI_PUBLIC int
+util_is_valid_path_string(const char *);
+
+/* Make sure the given file/dir exists.  Optionally check
+   to see if the other given file/dir exists and is a child
+   of the given file/dir
+*/
+NSAPI_PUBLIC int
+util_verify_file_or_dir(const char *path, PRFileType, const char *child, size_t, PRFileType);
+
 NSPR_END_EXTERN_C
 
 #endif	/* libadmin_h */




More information about the Fedora-directory-commits mailing list