1
0

dsalib.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifndef __dsalib_h
  39. #define __dsalib_h
  40. #include <stdio.h>
  41. #include <time.h>
  42. #include <stdarg.h>
  43. #ifdef HPUX
  44. #include <limits.h> /* for PATH_MAX */
  45. #endif
  46. /* error types */
  47. #define DS_FILE_ERROR 0
  48. #define DS_MEMORY_ERROR 1
  49. #define DS_SYSTEM_ERROR 2
  50. #define DS_INCORRECT_USAGE 3
  51. #define DS_ELEM_MISSING 4
  52. #define DS_REGISTRY_DATABASE_ERROR 5
  53. #define DS_NETWORK_ERROR 6
  54. #define DS_GENERAL_FAILURE 7
  55. #define DS_WARNING 8
  56. /* The upper bound on error types */
  57. #define DS_MAX_ERROR 9
  58. /* The default error type (in case something goes wrong */
  59. #define DS_DEFAULT_ERROR 3
  60. #ifndef BIG_LINE
  61. #define BIG_LINE 1024
  62. #endif
  63. #ifndef PATH_MAX
  64. #if defined( _WIN32 )
  65. #define PATH_MAX _MAX_PATH
  66. #else
  67. #define PATH_MAX 256
  68. #endif /* _WIN32 */
  69. #endif /* PATH_MAX */
  70. #ifndef HTML_ERRCOLOR
  71. #define HTML_ERRCOLOR "#AA0000"
  72. #endif
  73. #ifndef CONTENT_NAME
  74. #define CONTENT_NAME "content"
  75. #endif
  76. /* config file/path info */
  77. #define DS_CONFIG_DIR "DS_CONFIG_DIR"
  78. #define DS_CONFIG_FILE "dse.ldif"
  79. #define DS_ORIGCONFIG_FILE "dse_original.ldif"
  80. #define PIDFILE "PIDFILE"
  81. #define DS_CONFIG_LOCKDIR "nsslapd-lockdir:"
  82. #define DS_CONFIG_ERRLOG "nsslapd-errorlog:"
  83. #ifdef XP_UNIX
  84. #define FILE_PATHSEP '/'
  85. #define FILE_PATHSEPP "/"
  86. #define FILE_PARENT "../"
  87. #define WSACleanup()
  88. #elif defined(XP_WIN32)
  89. #define FILE_PATHSEP '/'
  90. #define FILE_PATHSEPP "\\\\"
  91. #define FILE_PARENT "..\\"
  92. #endif /* XP_WIN32 */
  93. #define PATH_SIZE 1024
  94. #define ERR_SIZE 8192
  95. /*
  96. NT doesn't strictly need these, but the libadmin API which is emulated
  97. below uses them.
  98. */
  99. #define NEWSCRIPT_MODE 0755
  100. #define NEWFILE_MODE 0644
  101. #define NEWDIR_MODE 0755
  102. #if defined( XP_WIN32 )
  103. #define DS_EXPORT_SYMBOL __declspec( dllexport )
  104. #else
  105. #define DS_EXPORT_SYMBOL
  106. #endif
  107. #if defined( XP_WIN32 )
  108. #define ENQUOTE "\""
  109. #else
  110. #define ENQUOTE ""
  111. #endif
  112. #ifndef FILE_SEP
  113. #ifdef XP_WIN32
  114. #define FILE_SEP '\\'
  115. #else
  116. #define FILE_SEP '/'
  117. #endif
  118. #endif
  119. #if defined( XP_WIN32 )
  120. #define PATH_FOR_PLATFORM(_path) ds_unixtodospath(_path)
  121. #else
  122. #define PATH_FOR_PLATFORM(_path)
  123. #endif
  124. #define START_SCRIPT "start-slapd"
  125. #define RESTART_SCRIPT "restart-slapd"
  126. #define STOP_SCRIPT "stop-slapd"
  127. #if defined( XP_WIN32 )
  128. #define SLAPD_NAME "slapd"
  129. #else
  130. #define SLAPD_NAME "ns-slapd"
  131. #endif
  132. #define MOCHA_NAME "JavaScript"
  133. /*
  134. * Return values from ds_get_updown_status()
  135. */
  136. #define DS_SERVER_UP 1
  137. #define DS_SERVER_DOWN 0
  138. #define DS_SERVER_UNKNOWN -1
  139. /*
  140. * Return values from ds_bring_up_server()
  141. */
  142. #define DS_SERVER_ALREADY_UP -2
  143. #define DS_SERVER_ALREADY_DOWN -3
  144. #define DS_SERVER_PORT_IN_USE -4
  145. #define DS_SERVER_MAX_SEMAPHORES -5
  146. #define DS_SERVER_CORRUPTED_DB -6
  147. #define DS_SERVER_NO_RESOURCES -7
  148. #define DS_SERVER_COULD_NOT_START -8
  149. /*
  150. * Other return values
  151. */
  152. #define DS_UNKNOWN_ERROR -1
  153. #define DS_NO_SERVER_ROOT -10
  154. #define DS_CANNOT_EXEC -11
  155. #define DS_CANNOT_OPEN_STAT_FILE -12
  156. #define DS_NULL_PARAMETER -13
  157. #define DS_SERVER_MUST_BE_DOWN -14
  158. #define DS_CANNOT_OPEN_BACKUP_FILE -15
  159. #define DS_NOT_A_DIRECTORY -16
  160. #define DS_CANNOT_CREATE_DIRECTORY -17
  161. #define DS_CANNOT_OPEN_LDIF_FILE -18
  162. #define DS_IS_A_DIRECTORY -19
  163. #define DS_CANNOT_CREATE_FILE -20
  164. #define DS_UNDEFINED_VARIABLE -21
  165. #define DS_NO_SUCH_FILE -22
  166. #define DS_CANNOT_DELETE_FILE -23
  167. #define DS_UNKNOWN_SNMP_COMMAND -24
  168. #define DS_NON_NUMERIC_VALUE -25
  169. #define DS_NO_LOGFILE_NAME -26
  170. #define DS_CANNOT_OPEN_LOG_FILE -27
  171. #define DS_HAS_TOBE_READONLY_MODE -28
  172. #define DS_INVALID_LDIF_FILE -29
  173. /*
  174. * Types of config files.
  175. */
  176. #define DS_REAL_CONFIG 1
  177. #define DS_TMP_CONFIG 2
  178. /*
  179. * Maximum numeric value we will accept in admin interface
  180. * We may at some point need per-option bounds, but for now,
  181. * there's just one global maximum.
  182. */
  183. #define DS_MAX_NUMERIC_VALUE 4294967295 /* 2^32 - 1 */
  184. /* Use our own macro for rpt_err, so we can put our own error code in
  185. NMC_STATUS */
  186. #undef rpt_err
  187. #define rpt_err(CODE, STR1, STR2, STR3) \
  188. fprintf( stdout, "NMC_ErrInfo: %s\n", (STR1) ); \
  189. fprintf( stdout, "NMC_STATUS: %d\n", CODE )
  190. /*
  191. * Flags for ds_display_config()
  192. */
  193. #define DS_DISP_HRB 1 /* horizontal line to begin with */
  194. #define DS_DISP_HRE 2 /* horizontal line to end with */
  195. #define DS_DISP_TB 4 /* table begin */
  196. #define DS_DISP_TE 8 /* table end */
  197. #define DS_DISP_EOL 16 /* End Of Line */
  198. #define DS_DISP_NOMT 32 /* display only non empty */
  199. #define DS_DISP_NOIN 64 /* display with no input field */
  200. #define DS_DISP_HELP 128 /* display with a help button */
  201. #define DS_DISP_PLAIN 256 /* No table, no nothin */
  202. #define DS_SIMPLE (DS_DISP_EOL | DS_DISP_NOIN | DS_DISP_HELP)
  203. /*
  204. * dci_type for ds_cfg_info
  205. */
  206. #define DS_ATTR_STRING 1
  207. #define DS_ATTR_NUMBER 2
  208. #define DS_ATTR_ONOFF 3
  209. #define DS_ATTR_LIMIT 4 /* a number where -1 is displayed as blank */
  210. struct ds_cfg_info {
  211. char *dci_varname;
  212. char *dci_display;
  213. int dci_type;
  214. char *dci_help;
  215. };
  216. extern struct ds_cfg_info ds_cfg_info[];
  217. #define LDBM_DATA_SIZE 5
  218. /*ldbm specific backend information*/
  219. struct ldbm_data {
  220. char *tv[LDBM_DATA_SIZE][2]; /*type and value*/
  221. };
  222. /*
  223. * varname for ds_showparam()
  224. * NOTE: these must be kept in synch with the ds_cfg_info array defined
  225. * in ../lib/dsalib_conf.c
  226. */
  227. #define DS_LOGLEVEL 0
  228. #define DS_REFERRAL 1
  229. #define DS_AUDITFILE 2
  230. #define DS_LOCALHOST 3
  231. #define DS_PORT 4
  232. #define DS_SECURITY 5
  233. #define DS_SECURE_PORT 6
  234. #define DS_SSL3CIPHERS 7
  235. #define DS_PASSWDHASH 8
  236. #define DS_ACCESSLOG 9
  237. #define DS_ERRORLOG 10
  238. #define DS_ROOTDN 11
  239. #define DS_ROOTPW 12
  240. #define DS_SUFFIX 13
  241. #define DS_LOCALUSER 14
  242. #define DS_CFG_MAX 15 /* MUST be one greater than the last option */
  243. /* These control how long we wait for the server to start up or shutdown */
  244. #define SERVER_START_TIMEOUT 600 /* seconds */
  245. #define SERVER_STOP_TIMEOUT SERVER_START_TIMEOUT /* same as start timeout */
  246. typedef int (*DS_RM_RF_ERR_FUNC)(const char *path, const char *op, void *arg);
  247. #ifdef __cplusplus
  248. extern "C" {
  249. #endif /* __cplusplus */
  250. extern DS_EXPORT_SYMBOL char *ds_get_server_root();
  251. extern DS_EXPORT_SYMBOL char *ds_get_install_root();
  252. extern DS_EXPORT_SYMBOL char *ds_get_admserv_based_root();
  253. extern DS_EXPORT_SYMBOL void ds_log_debug_message(char *msg);
  254. extern DS_EXPORT_SYMBOL void ds_log_env(char **envp);
  255. extern DS_EXPORT_SYMBOL int ds_get_updown_status();
  256. extern DS_EXPORT_SYMBOL void ds_print_startstop(int stop);
  257. extern DS_EXPORT_SYMBOL int ds_bring_up_server_install(int verbose,
  258. char *root, char *errorlog);
  259. extern DS_EXPORT_SYMBOL int ds_bring_up_server(int verbose);
  260. extern DS_EXPORT_SYMBOL char *ds_get_server_name();
  261. extern DS_EXPORT_SYMBOL void ds_send_error(char *errstr, int print_errno);
  262. extern DS_EXPORT_SYMBOL void ds_send_status(char *str);
  263. extern DS_EXPORT_SYMBOL char *ds_get_cgi_var(char *cgi_var_name);
  264. extern DS_EXPORT_SYMBOL char *ds_get_cgi_var_simple(int index);
  265. extern DS_EXPORT_SYMBOL char *ds_get_cgi_multiple(char *cgi_var_name);
  266. extern DS_EXPORT_SYMBOL char *ds_get_errors_name();
  267. extern DS_EXPORT_SYMBOL char *ds_get_access_name();
  268. extern DS_EXPORT_SYMBOL char *ds_get_audit_name();
  269. extern DS_EXPORT_SYMBOL char *ds_get_logfile_name(int config_type);
  270. extern DS_EXPORT_SYMBOL int ds_bring_down_server();
  271. extern DS_EXPORT_SYMBOL void ds_print_server_status(int isrunning);
  272. extern DS_EXPORT_SYMBOL int ds_get_file_size(char *fileName);
  273. extern DS_EXPORT_SYMBOL void ds_display_tail(char *fileName, int timeOut,
  274. int startSeek, char *doneMsg, char *lastLine);
  275. extern DS_EXPORT_SYMBOL int ds_ldif2db_preserve(char *file);
  276. extern DS_EXPORT_SYMBOL int ds_ldif2db(char *file);
  277. extern DS_EXPORT_SYMBOL int ds_ldif2db_backend_subtree(char *file, char *backend, char *subtree);
  278. extern DS_EXPORT_SYMBOL int ds_db2ldif(char *file);
  279. extern DS_EXPORT_SYMBOL int ds_vlvindex(char **backendList, char **attrList);
  280. extern DS_EXPORT_SYMBOL int ds_addindex(char **attrList, char *backendName);
  281. extern DS_EXPORT_SYMBOL int ds_db2ldif_subtree(char *file, char *subtree);
  282. extern DS_EXPORT_SYMBOL char **ds_get_bak_dirs();
  283. extern DS_EXPORT_SYMBOL int ds_db2bak(char *file);
  284. extern DS_EXPORT_SYMBOL int ds_bak2db(char *file);
  285. extern DS_EXPORT_SYMBOL int ds_get_monitor(int frontend, char *port);
  286. extern DS_EXPORT_SYMBOL int ds_get_bemonitor(char *bemdn, char *port);
  287. extern DS_EXPORT_SYMBOL int ds_client_access(char *port, char *dn);
  288. extern DS_EXPORT_SYMBOL char **ds_get_config(int type);
  289. extern DS_EXPORT_SYMBOL char *ds_get_config_dir();
  290. extern DS_EXPORT_SYMBOL void ds_set_config_dir(char *config_dir);
  291. extern DS_EXPORT_SYMBOL char *ds_get_run_dir();
  292. extern DS_EXPORT_SYMBOL void ds_set_run_dir(char *run_dir);
  293. extern DS_EXPORT_SYMBOL char *ds_get_bak_dir();
  294. extern DS_EXPORT_SYMBOL void ds_set_bak_dir(char *bak_dir);
  295. extern DS_EXPORT_SYMBOL char *ds_get_pwenc(char *passwd_hash, char *password);
  296. extern DS_EXPORT_SYMBOL int ds_check_config(int type);
  297. extern DS_EXPORT_SYMBOL int ds_check_pw(char *pwhash, char *pwclear);
  298. extern DS_EXPORT_SYMBOL int ds_set_config(char *change_file_name);
  299. extern DS_EXPORT_SYMBOL char **ds_get_conf_from_file(FILE *conf);
  300. extern DS_EXPORT_SYMBOL void ds_display_config(char **ds_config);
  301. extern DS_EXPORT_SYMBOL char *ds_get_var_name(int varnum);
  302. extern DS_EXPORT_SYMBOL int ds_showparam(char **ds_config, int varname, int phase,
  303. int occurance, char *dispname, int size, int maxlength, unsigned flags,
  304. char *url);
  305. extern DS_EXPORT_SYMBOL void ds_show_pwmaxage(char *value);
  306. extern DS_EXPORT_SYMBOL void ds_show_pwhash(char *value);
  307. extern DS_EXPORT_SYMBOL char *ds_get_value(char **ds_config, char *parm, int phase, int occurance);
  308. extern DS_EXPORT_SYMBOL void ds_apply_cfg_changes(int param_list[], int changed);
  309. extern DS_EXPORT_SYMBOL int ds_commit_cfg_changes();
  310. extern DS_EXPORT_SYMBOL int ds_config_updated();
  311. extern DS_EXPORT_SYMBOL void ds_display_header(char *font_size, char *header);
  312. extern DS_EXPORT_SYMBOL void ds_display_message(char *font_size, char *header);
  313. extern DS_EXPORT_SYMBOL void ds_print_file_form(char *action, char *fileptr, char *full_fileptr);
  314. extern DS_EXPORT_SYMBOL char *ds_get_file_meaning(char *file);
  315. extern DS_EXPORT_SYMBOL void ds_print_file_name(char *fileptr);
  316. extern DS_EXPORT_SYMBOL int ds_file_exists(char *filename);
  317. extern DS_EXPORT_SYMBOL int ds_cp_file(char *sfile, char *dfile, int mode);
  318. extern DS_EXPORT_SYMBOL time_t ds_get_mtime(char *filename);
  319. extern DS_EXPORT_SYMBOL char *ds_get_config_value( int option );
  320. extern DS_EXPORT_SYMBOL char **ds_get_file_list( char *dir );
  321. extern DS_EXPORT_SYMBOL char *ds_get_tmp_dir();
  322. extern DS_EXPORT_SYMBOL void ds_unixtodospath(char *szText);
  323. extern DS_EXPORT_SYMBOL void ds_timetofname(char *szText);
  324. extern DS_EXPORT_SYMBOL void ds_dostounixpath(char *szText);
  325. extern DS_EXPORT_SYMBOL int ds_saferename(char *szSrc, char *szTarget);
  326. extern DS_EXPORT_SYMBOL char *get_specific_help_button(char *help_link,
  327. char *dispname, char *helpinfo);
  328. /* Change the DN to a canonical format (in place); return DN. */
  329. extern DS_EXPORT_SYMBOL char* dn_normalize (char* DN);
  330. /* Change the DN to a canonical format (in place) and convert to v3; return DN. */
  331. extern DS_EXPORT_SYMBOL char* dn_normalize_convert (char* DN);
  332. /* if dn contains an unescaped quote return true */
  333. extern DS_EXPORT_SYMBOL int ds_dn_uses_LDAPv2_quoting(const char *dn);
  334. /* Return a copy of the DN, but with optional whitespace inserted. */
  335. extern DS_EXPORT_SYMBOL char* ds_dn_expand (char* DN);
  336. /* Return the value if it can be stored 'as is' in a config file.
  337. If it requires enquoting, allocate and return its enquoted form.
  338. The caller should free() the returned pointer iff it's != value.
  339. On Windows, we don't want to double up on "\" characters in filespecs,
  340. so we need to pass in the value type */
  341. extern DS_EXPORT_SYMBOL char* ds_enquote_config_value (int paramnum, char* value);
  342. /*
  343. * Bring up a javascript alert.
  344. */
  345. extern DS_EXPORT_SYMBOL void ds_alert_user(char *header, char *message);
  346. /* Construct and return the DN that corresponds to the give DNS name.
  347. The caller should free() the returned pointer. */
  348. extern DS_EXPORT_SYMBOL char* ds_DNS_to_DN (char* DNS);
  349. /* Construct and return the DN of the LDAP server's own entry.
  350. The caller must NOT free() the returned pointer. */
  351. extern DS_EXPORT_SYMBOL char* ds_get_config_DN (char** ds_config);
  352. /* Encode characters, as described in RFC 1738 section 2.2,
  353. if they're 'unsafe' (as defined in RFC 1738), or '?' or
  354. <special> (as defined in RFC 1779).
  355. The caller should free() the returned pointer. */
  356. extern DS_EXPORT_SYMBOL char* ds_URL_encode (const char*);
  357. /* Decode characters, as described in RFC 1738 section 2.2.
  358. The caller should free() the returned pointer. */
  359. extern DS_EXPORT_SYMBOL char* ds_URL_decode (const char*);
  360. /* Encode all characters, even if 'safe' */
  361. extern DS_EXPORT_SYMBOL char* ds_encode_all (const char*);
  362. /* Change the effective UID and GID of this process to
  363. those associated with the given localuser (if any). */
  364. extern DS_EXPORT_SYMBOL char* ds_become_localuser_name (char* localuser);
  365. /* Change the effective UID and GID of this process to
  366. those associated with ds_config's localuser (if any). */
  367. extern DS_EXPORT_SYMBOL char* ds_become_localuser (char** ds_config);
  368. /* Change the effective UID and GID of this process back to
  369. what they were before calling ds_become_localuser(). */
  370. extern DS_EXPORT_SYMBOL char* ds_become_original();
  371. extern DS_EXPORT_SYMBOL char* ds_makeshort(char *filepath);
  372. extern DS_EXPORT_SYMBOL int ds_search_file(char *filename, char *searchstring, char **returnstring);
  373. /* Begin parsing a POST in a CGI context */
  374. extern DS_EXPORT_SYMBOL int ds_post_begin(FILE *input);
  375. /* Begin parsing a GET in a CGI context */
  376. extern DS_EXPORT_SYMBOL void ds_get_begin(char *query_string);
  377. /* Display an error to the user and exit from a CGI */
  378. extern DS_EXPORT_SYMBOL void ds_report_error(int type, char *errmsg, char *details);
  379. /* Display a warning to the user */
  380. extern DS_EXPORT_SYMBOL void ds_report_warning(int type, char *errmsg, char *details);
  381. /* These functions are used by the program to alter the output behaviour
  382. if not executing in a CGI context */
  383. extern DS_EXPORT_SYMBOL int ds_get_formatted_output(void);
  384. extern DS_EXPORT_SYMBOL void ds_set_formatted_output(int val);
  385. /* return the value of a CGI variable */
  386. extern DS_EXPORT_SYMBOL char *ds_a_get_cgi_var(char *varname, char *elem_id, char *bongmsg);
  387. /* return a multi-valued CGI variable */
  388. extern DS_EXPORT_SYMBOL char **ds_a_get_cgi_multiple(char *varname, char *elem_id, char *bongmsg);
  389. /* open an html file */
  390. extern DS_EXPORT_SYMBOL FILE *ds_open_html_file(char *filename);
  391. /* show a message to be parsed by the non-HTML front end */
  392. extern DS_EXPORT_SYMBOL void ds_show_message(const char *message);
  393. /* show a key/value pair to be parsed by the non-HTML front end */
  394. extern DS_EXPORT_SYMBOL void ds_show_key_value(char *key, char *value);
  395. extern DS_EXPORT_SYMBOL void ds_submit(char *helptarget) ;
  396. extern DS_EXPORT_SYMBOL char *ds_get_helpbutton(char *topic);
  397. extern DS_EXPORT_SYMBOL void alter_startup_line(char *startup_line);
  398. extern DS_EXPORT_SYMBOL int ds_dir_exists(char *fn);
  399. extern DS_EXPORT_SYMBOL int ds_mkdir(char *dir, int mode);
  400. extern DS_EXPORT_SYMBOL char *ds_mkdir_p(char *dir, int mode);
  401. extern DS_EXPORT_SYMBOL char *ds_salted_sha1_pw_enc (char* pwd);
  402. extern DS_EXPORT_SYMBOL char * ds_escape_for_shell( char *s );
  403. extern DS_EXPORT_SYMBOL char **ds_string_to_vec(char *s);
  404. extern DS_EXPORT_SYMBOL char *ds_system_errmsg(void);
  405. extern DS_EXPORT_SYMBOL int ds_exec_and_report(char *cmd);
  406. /* remove a directory hierarchy - if the error function is given, it will be called upon
  407. error (e.g. directory not readable, cannot remove file, etc.) - if the callback function
  408. returns 0, this means to abort the removal, otherwise, continue
  409. */
  410. extern DS_EXPORT_SYMBOL int ds_rm_rf(const char *dir, DS_RM_RF_ERR_FUNC ds_rm_rf_err_func, void *arg);
  411. /*
  412. remove a registry key and report an error message if unsuccessful
  413. */
  414. extern DS_EXPORT_SYMBOL int ds_remove_reg_key(void *base, const char *format, ...);
  415. #ifdef __cplusplus
  416. }
  417. #endif /* __cplusplus */
  418. #endif /* __dsalib_h */