mainconfig.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. /*
  2. * Copyright (c) 2002-2005 MontaVista Software, Inc.
  3. * Copyright (c) 2006-2009 Red Hat, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Author: Steven Dake (sdake@redhat.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. #include <config.h>
  36. #include <stdio.h>
  37. #include <string.h>
  38. #include <stdlib.h>
  39. #include <errno.h>
  40. #include <assert.h>
  41. #include <sys/socket.h>
  42. #include <netinet/in.h>
  43. #include <arpa/inet.h>
  44. #include <pwd.h>
  45. #include <grp.h>
  46. #include <limits.h>
  47. #include <corosync/corotypes.h>
  48. #include <corosync/list.h>
  49. #include <corosync/totem/totem.h>
  50. #include <corosync/engine/logsys.h>
  51. #include "util.h"
  52. #include "mainconfig.h"
  53. #include "mempool.h"
  54. static char error_string_response[512];
  55. static struct objdb_iface_ver0 *global_objdb;
  56. /* This just makes the code below a little neater */
  57. static inline int objdb_get_string (
  58. const struct objdb_iface_ver0 *objdb,
  59. hdb_handle_t object_service_handle,
  60. const char *key, char **value)
  61. {
  62. int res;
  63. *value = NULL;
  64. if ( !(res = objdb->object_key_get (object_service_handle,
  65. key,
  66. strlen (key),
  67. (void *)value,
  68. NULL))) {
  69. if (*value) {
  70. return 0;
  71. }
  72. }
  73. return -1;
  74. }
  75. static inline void objdb_get_int (
  76. const struct objdb_iface_ver0 *objdb,
  77. hdb_handle_t object_service_handle,
  78. char *key, unsigned int *intvalue)
  79. {
  80. char *value = NULL;
  81. if (!objdb->object_key_get (object_service_handle,
  82. key,
  83. strlen (key),
  84. (void *)&value,
  85. NULL)) {
  86. if (value) {
  87. *intvalue = atoi(value);
  88. }
  89. }
  90. }
  91. /**
  92. * insert_into_buffer
  93. * @target_buffer: a buffer where to write results
  94. * @bufferlen: tell us the size of the buffer to avoid overflows
  95. * @entry: entry that needs to be added to the buffer
  96. * @after: can either be NULL or set to a string.
  97. * if NULL, @entry is prependend to logsys_format_get buffer.
  98. * if set, @entry is added immediately after @after.
  99. *
  100. * Since the function is specific to logsys_format_get handling, it is implicit
  101. * that source is logsys_format_get();
  102. *
  103. * In case of failure, target_buffer could be left dirty. So don't trust
  104. * any data leftover in it.
  105. *
  106. * Searching for "after" assumes that there is only entry of "after"
  107. * in the source. Afterall we control the string here and for logging format
  108. * it makes little to no sense to have duplicate format entries.
  109. *
  110. * Returns: 0 on success, -1 on failure
  111. **/
  112. static int insert_into_buffer(
  113. char *target_buffer,
  114. size_t bufferlen,
  115. const char *entry,
  116. const char *after)
  117. {
  118. const char *current_format = NULL;
  119. current_format = logsys_format_get();
  120. /* if the entry is already in the format we don't add it again */
  121. if (strstr(current_format, entry) != NULL) {
  122. return -1;
  123. }
  124. /* if there is no "after", simply prepend the requested entry
  125. * otherwise go for beautiful string manipulation.... </sarcasm> */
  126. if (!after) {
  127. if (snprintf(target_buffer, bufferlen - 1, "%s%s",
  128. entry,
  129. current_format) >= bufferlen - 1) {
  130. return -1;
  131. }
  132. } else {
  133. const char *afterpos;
  134. size_t afterlen;
  135. size_t templen;
  136. /* check if after is contained in the format
  137. * and afterlen has a meaning or return an error */
  138. afterpos = strstr(current_format, after);
  139. afterlen = strlen(after);
  140. if ((!afterpos) || (!afterlen)) {
  141. return -1;
  142. }
  143. templen = afterpos - current_format + afterlen;
  144. if (snprintf(target_buffer, templen + 1, "%s", current_format)
  145. >= bufferlen - 1) {
  146. return -1;
  147. }
  148. if (snprintf(target_buffer + templen, bufferlen - ( templen + 1 ),
  149. "%s%s", entry, current_format + templen)
  150. >= bufferlen - ( templen + 1 )) {
  151. return -1;
  152. }
  153. }
  154. return 0;
  155. }
  156. /*
  157. * format set is the only global specific option that
  158. * doesn't apply at system/subsystem level.
  159. */
  160. static int corosync_main_config_format_set (
  161. struct objdb_iface_ver0 *objdb,
  162. hdb_handle_t object_handle,
  163. const char **error_string)
  164. {
  165. const char *error_reason;
  166. char new_format_buffer[PATH_MAX];
  167. char *value;
  168. int err = 0;
  169. if (!objdb_get_string (objdb,object_handle, "fileline", &value)) {
  170. if (strcmp (value, "on") == 0) {
  171. if (!insert_into_buffer(new_format_buffer,
  172. sizeof(new_format_buffer),
  173. " %f:%l", "s]")) {
  174. err = logsys_format_set(new_format_buffer);
  175. } else
  176. if (!insert_into_buffer(new_format_buffer,
  177. sizeof(new_format_buffer),
  178. "%f:%l", NULL)) {
  179. err = logsys_format_set(new_format_buffer);
  180. }
  181. } else
  182. if (strcmp (value, "off") == 0) {
  183. /* nothing to do here */
  184. } else {
  185. error_reason = "unknown value for fileline";
  186. goto parse_error;
  187. }
  188. }
  189. if (!objdb_get_string (objdb,object_handle, "function_name", &value)) {
  190. if (strcmp (value, "on") == 0) {
  191. if (!insert_into_buffer(new_format_buffer,
  192. sizeof(new_format_buffer),
  193. "%n:", "f:")) {
  194. err = logsys_format_set(new_format_buffer);
  195. } else
  196. if (!insert_into_buffer(new_format_buffer,
  197. sizeof(new_format_buffer),
  198. " %n", "s]")) {
  199. err = logsys_format_set(new_format_buffer);
  200. }
  201. } else
  202. if (strcmp (value, "off") == 0) {
  203. /* nothing to do here */
  204. } else {
  205. error_reason = "unknown value for function_name";
  206. goto parse_error;
  207. }
  208. }
  209. if (!objdb_get_string (objdb,object_handle, "timestamp", &value)) {
  210. if (strcmp (value, "on") == 0) {
  211. if(!insert_into_buffer(new_format_buffer,
  212. sizeof(new_format_buffer),
  213. "%t ", NULL)) {
  214. err = logsys_format_set(new_format_buffer);
  215. }
  216. } else
  217. if (strcmp (value, "off") == 0) {
  218. /* nothing to do here */
  219. } else {
  220. error_reason = "unknown value for timestamp";
  221. goto parse_error;
  222. }
  223. }
  224. if (err) {
  225. error_reason = "exhausted virtual memory";
  226. goto parse_error;
  227. }
  228. return (0);
  229. parse_error:
  230. *error_string = error_reason;
  231. return (-1);
  232. }
  233. static int corosync_main_config_set (
  234. struct objdb_iface_ver0 *objdb,
  235. hdb_handle_t object_handle,
  236. const char *subsys,
  237. const char **error_string)
  238. {
  239. const char *error_reason = error_string_response;
  240. char *value;
  241. unsigned int mode;
  242. /*
  243. * this bit abuses the internal logsys exported API
  244. * to guarantee that all configured subsystems are
  245. * initialized too.
  246. *
  247. * using this approach avoids some headaches caused
  248. * by IPC and TOTEM that have a special logging
  249. * handling requirements
  250. */
  251. if (subsys != NULL) {
  252. if (_logsys_subsys_create(subsys) < 0) {
  253. error_reason = "unable to create new logging subsystem";
  254. goto parse_error;
  255. }
  256. }
  257. mode = logsys_config_mode_get(subsys);
  258. if (mode < 0) {
  259. error_reason = "unable to get mode";
  260. goto parse_error;
  261. }
  262. if (!objdb_get_string (objdb,object_handle, "to_file", &value)) {
  263. log_printf(LOGSYS_LEVEL_WARNING,
  264. "Warning: the to_file config paramater has been obsoleted."
  265. " See corosync.conf man page to_logfile directive.");
  266. if (strcmp (value, "yes") == 0) {
  267. mode |= LOGSYS_MODE_OUTPUT_FILE;
  268. if (logsys_config_mode_set(subsys, mode) < 0) {
  269. error_reason = "unable to set mode to_file";
  270. goto parse_error;
  271. }
  272. } else
  273. if (strcmp (value, "no") == 0) {
  274. mode &= ~LOGSYS_MODE_OUTPUT_FILE;
  275. if (logsys_config_mode_set(subsys, mode) < 0) {
  276. error_reason = "unable to unset mode to_file";
  277. goto parse_error;
  278. }
  279. } else {
  280. error_reason = "unknown value for to_file";
  281. goto parse_error;
  282. }
  283. }
  284. if (!objdb_get_string (objdb,object_handle, "to_logfile", &value)) {
  285. if (strcmp (value, "yes") == 0) {
  286. mode |= LOGSYS_MODE_OUTPUT_FILE;
  287. if (logsys_config_mode_set(subsys, mode) < 0) {
  288. error_reason = "unable to set mode to_logfile";
  289. goto parse_error;
  290. }
  291. } else
  292. if (strcmp (value, "no") == 0) {
  293. mode &= ~LOGSYS_MODE_OUTPUT_FILE;
  294. if (logsys_config_mode_set(subsys, mode) < 0) {
  295. error_reason = "unable to unset mode to_logfile";
  296. goto parse_error;
  297. }
  298. } else {
  299. error_reason = "unknown value for to_logfile";
  300. goto parse_error;
  301. }
  302. }
  303. if (!objdb_get_string (objdb,object_handle, "to_syslog", &value)) {
  304. if (strcmp (value, "yes") == 0) {
  305. mode |= LOGSYS_MODE_OUTPUT_SYSLOG;
  306. if (logsys_config_mode_set(subsys, mode) < 0) {
  307. error_reason = "unable to set mode to_syslog";
  308. goto parse_error;
  309. }
  310. } else
  311. if (strcmp (value, "no") == 0) {
  312. mode &= ~LOGSYS_MODE_OUTPUT_SYSLOG;
  313. if (logsys_config_mode_set(subsys, mode) < 0) {
  314. error_reason = "unable to unset mode to_syslog";
  315. goto parse_error;
  316. }
  317. } else {
  318. error_reason = "unknown value for to_syslog";
  319. goto parse_error;
  320. }
  321. }
  322. if (!objdb_get_string (objdb,object_handle, "to_stderr", &value)) {
  323. if (strcmp (value, "yes") == 0) {
  324. mode |= LOGSYS_MODE_OUTPUT_STDERR;
  325. if (logsys_config_mode_set(subsys, mode) < 0) {
  326. error_reason = "unable to set mode to_stderr";
  327. goto parse_error;
  328. }
  329. } else
  330. if (strcmp (value, "no") == 0) {
  331. mode &= ~LOGSYS_MODE_OUTPUT_STDERR;
  332. if (logsys_config_mode_set(subsys, mode) < 0) {
  333. error_reason = "unable to unset mode to_stderr";
  334. goto parse_error;
  335. }
  336. } else {
  337. error_reason = "unknown value for to_syslog";
  338. goto parse_error;
  339. }
  340. }
  341. if (!objdb_get_string (objdb,object_handle, "syslog_facility", &value)) {
  342. int syslog_facility;
  343. syslog_facility = logsys_facility_id_get(value);
  344. if (syslog_facility < 0) {
  345. error_reason = "unknown syslog facility specified";
  346. goto parse_error;
  347. }
  348. if (logsys_config_syslog_facility_set(subsys,
  349. syslog_facility) < 0) {
  350. error_reason = "unable to set syslog facility";
  351. goto parse_error;
  352. }
  353. }
  354. if (!objdb_get_string (objdb,object_handle, "syslog_level", &value)) {
  355. int syslog_priority;
  356. log_printf(LOGSYS_LEVEL_WARNING,
  357. "Warning: the syslog_level config paramater has been obsoleted."
  358. " See corosync.conf man page syslog_priority directive.");
  359. syslog_priority = logsys_priority_id_get(value);
  360. if (syslog_priority < 0) {
  361. error_reason = "unknown syslog level specified";
  362. goto parse_error;
  363. }
  364. if (logsys_config_syslog_priority_set(subsys,
  365. syslog_priority) < 0) {
  366. error_reason = "unable to set syslog level";
  367. goto parse_error;
  368. }
  369. }
  370. if (!objdb_get_string (objdb,object_handle, "syslog_priority", &value)) {
  371. int syslog_priority;
  372. syslog_priority = logsys_priority_id_get(value);
  373. if (syslog_priority < 0) {
  374. error_reason = "unknown syslog priority specified";
  375. goto parse_error;
  376. }
  377. if (logsys_config_syslog_priority_set(subsys,
  378. syslog_priority) < 0) {
  379. error_reason = "unable to set syslog priority";
  380. goto parse_error;
  381. }
  382. }
  383. if (!objdb_get_string (objdb,object_handle, "logfile", &value)) {
  384. if (logsys_config_file_set (subsys, error_string, value) < 0) {
  385. goto parse_error;
  386. }
  387. }
  388. if (!objdb_get_string (objdb,object_handle, "logfile_priority", &value)) {
  389. int logfile_priority;
  390. logfile_priority = logsys_priority_id_get(value);
  391. if (logfile_priority < 0) {
  392. error_reason = "unknown logfile priority specified";
  393. goto parse_error;
  394. }
  395. if (logsys_config_logfile_priority_set(subsys,
  396. logfile_priority) < 0) {
  397. error_reason = "unable to set logfile priority";
  398. goto parse_error;
  399. }
  400. }
  401. if (!objdb_get_string (objdb, object_handle, "debug", &value)) {
  402. if (strcmp (value, "on") == 0) {
  403. if (logsys_config_debug_set (subsys, 1) < 0) {
  404. error_reason = "unable to set debug on";
  405. goto parse_error;
  406. }
  407. } else
  408. if (strcmp (value, "off") == 0) {
  409. if (logsys_config_debug_set (subsys, 0) < 0) {
  410. error_reason = "unable to set debug off";
  411. goto parse_error;
  412. }
  413. } else {
  414. error_reason = "unknown value for debug";
  415. goto parse_error;
  416. }
  417. }
  418. if (!objdb_get_string (objdb, object_handle, "tags", &value)) {
  419. char *temp, *token;
  420. unsigned int tags = 0;
  421. temp = strdup(value);
  422. if (temp == NULL) {
  423. error_reason = "exhausted virtual memory";
  424. goto parse_error;
  425. }
  426. while ((token = strsep(&temp, "|")) != NULL) {
  427. int val;
  428. val = logsys_tag_id_get(token);
  429. if (val < 0) {
  430. error_reason = "bad tags value";
  431. goto parse_error;
  432. }
  433. tags |= val;
  434. }
  435. free(temp);
  436. tags |= LOGSYS_TAG_LOG;
  437. if (logsys_config_tags_set (subsys, tags) < 0) {
  438. error_reason = "unable to set tags";
  439. goto parse_error;
  440. }
  441. }
  442. return (0);
  443. parse_error:
  444. *error_string = error_reason;
  445. return (-1);
  446. }
  447. static int corosync_main_config_read_logging (
  448. struct objdb_iface_ver0 *objdb,
  449. const char **error_string)
  450. {
  451. hdb_handle_t object_service_handle;
  452. hdb_handle_t object_logger_subsys_handle;
  453. hdb_handle_t object_find_handle;
  454. hdb_handle_t object_find_logsys_handle;
  455. const char *error_reason;
  456. char *value;
  457. objdb->object_find_create (
  458. OBJECT_PARENT_HANDLE,
  459. "logging",
  460. strlen ("logging"),
  461. &object_find_handle);
  462. if (objdb->object_find_next (
  463. object_find_handle,
  464. &object_service_handle) == 0) {
  465. /* format set is supported only for toplevel */
  466. if (corosync_main_config_format_set (objdb,
  467. object_service_handle,
  468. &error_reason) < 0) {
  469. goto parse_error;
  470. }
  471. if (corosync_main_config_set (objdb,
  472. object_service_handle,
  473. NULL,
  474. &error_reason) < 0) {
  475. goto parse_error;
  476. }
  477. /* we will need 2 of these to compensate for new logging
  478. * config format */
  479. objdb->object_find_create (
  480. object_service_handle,
  481. "logger_subsys",
  482. strlen ("logger_subsys"),
  483. &object_find_logsys_handle);
  484. while (objdb->object_find_next (
  485. object_find_logsys_handle,
  486. &object_logger_subsys_handle) == 0) {
  487. if (!objdb_get_string (objdb,
  488. object_logger_subsys_handle,
  489. "subsys", &value)) {
  490. if (corosync_main_config_set (objdb,
  491. object_logger_subsys_handle,
  492. value,
  493. &error_reason) < 0) {
  494. goto parse_error;
  495. }
  496. }
  497. else {
  498. error_reason = "subsys required for logger directive";
  499. goto parse_error;
  500. }
  501. }
  502. objdb->object_find_destroy (object_find_logsys_handle);
  503. objdb->object_find_create (
  504. object_service_handle,
  505. "logging_daemon",
  506. strlen ("logging_daemon"),
  507. &object_find_logsys_handle);
  508. while (objdb->object_find_next (
  509. object_find_logsys_handle,
  510. &object_logger_subsys_handle) == 0) {
  511. if (!objdb_get_string (objdb,
  512. object_logger_subsys_handle,
  513. "name", &value)) {
  514. if ((strcmp(value, "corosync") == 0) &&
  515. (!objdb_get_string (objdb,
  516. object_logger_subsys_handle,
  517. "subsys", &value))) {
  518. if (corosync_main_config_set (objdb,
  519. object_logger_subsys_handle,
  520. value,
  521. &error_reason) < 0) {
  522. goto parse_error;
  523. }
  524. }
  525. else {
  526. error_reason = "subsys required for logging_daemon directive";
  527. goto parse_error;
  528. }
  529. }
  530. else {
  531. error_reason = "name required for logging_daemon directive";
  532. goto parse_error;
  533. }
  534. }
  535. objdb->object_find_destroy (object_find_logsys_handle);
  536. }
  537. objdb->object_find_destroy (object_find_handle);
  538. return 0;
  539. parse_error:
  540. *error_string = error_reason;
  541. return (-1);
  542. }
  543. static int uid_determine (const char *req_user)
  544. {
  545. struct passwd *passwd;
  546. int ais_uid = 0;
  547. passwd = getpwnam(req_user);
  548. if (passwd == 0) {
  549. log_printf (LOGSYS_LEVEL_ERROR, "ERROR: The '%s' user is not found in /etc/passwd, please read the documentation.\n", req_user);
  550. corosync_exit_error (AIS_DONE_UID_DETERMINE);
  551. }
  552. ais_uid = passwd->pw_uid;
  553. endpwent ();
  554. return ais_uid;
  555. }
  556. static int gid_determine (const char *req_group)
  557. {
  558. struct group *group;
  559. int ais_gid = 0;
  560. group = getgrnam (req_group);
  561. if (group == 0) {
  562. log_printf (LOGSYS_LEVEL_ERROR, "ERROR: The '%s' group is not found in /etc/group, please read the documentation.\n", req_group);
  563. corosync_exit_error (AIS_DONE_GID_DETERMINE);
  564. }
  565. ais_gid = group->gr_gid;
  566. endgrent ();
  567. return ais_gid;
  568. }
  569. static void main_objdb_reload_notify(objdb_reload_notify_type_t type, int flush,
  570. void *priv_data_pt)
  571. {
  572. const char *error_string;
  573. if (type == OBJDB_RELOAD_NOTIFY_END) {
  574. /*
  575. * Reload the logsys configuration
  576. */
  577. logsys_format_set(NULL);
  578. corosync_main_config_read_logging(global_objdb,
  579. &error_string);
  580. }
  581. }
  582. static void add_logsys_config_notification(
  583. struct objdb_iface_ver0 *objdb)
  584. {
  585. global_objdb = objdb;
  586. objdb->object_track_start(OBJECT_PARENT_HANDLE,
  587. 1,
  588. NULL,
  589. NULL,
  590. NULL,
  591. main_objdb_reload_notify,
  592. NULL);
  593. }
  594. int corosync_main_config_read (
  595. struct objdb_iface_ver0 *objdb,
  596. const char **error_string,
  597. struct ug_config *ug_config)
  598. {
  599. hdb_handle_t object_service_handle;
  600. char *value;
  601. const char *error_reason = error_string_response;
  602. hdb_handle_t object_find_handle;
  603. memset (ug_config, 0, sizeof (struct ug_config));
  604. if (corosync_main_config_read_logging(objdb, error_string) < 0) {
  605. error_reason = *error_string;
  606. goto parse_error;
  607. }
  608. ug_config->uid = -1;
  609. ug_config->gid = -1;
  610. objdb->object_find_create (
  611. OBJECT_PARENT_HANDLE,
  612. "aisexec",
  613. strlen ("aisexec"),
  614. &object_find_handle);
  615. if (objdb->object_find_next (
  616. object_find_handle,
  617. &object_service_handle) == 0) {
  618. if (!objdb_get_string (objdb,object_service_handle, "user", &value)) {
  619. ug_config->uid = uid_determine(value);
  620. }
  621. if (!objdb_get_string (objdb,object_service_handle, "group", &value)) {
  622. ug_config->gid = gid_determine(value);
  623. }
  624. }
  625. objdb->object_find_destroy (object_find_handle);
  626. if (ug_config->uid < 0) {
  627. ug_config->uid = uid_determine("ais");
  628. }
  629. if (ug_config->gid < 0) {
  630. ug_config->gid = gid_determine("ais");
  631. }
  632. add_logsys_config_notification(objdb);
  633. logsys_fork_completed ();
  634. return 0;
  635. parse_error:
  636. snprintf (error_string_response, sizeof(error_string_response),
  637. "parse error in config: %s.\n",
  638. error_reason);
  639. *error_string = error_string_response;
  640. return (-1);
  641. }