- Timestamp:
- Nov 1, 2012, 7:45:54 AM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/samhain.c
r411 r415 712 712 #if defined(SH_WITH_SERVER) 713 713 extern int sh_socket_remove (void); 714 extern int sh_html_zero(); 714 715 #endif 715 716 … … 743 744 */ 744 745 #if defined(SH_WITH_SERVER) 745 sh_forward_html_write(); 746 /* zero out the status file at exit, such that the status 747 * of client becomes unknown in the beltane interface 748 */ 749 sh_html_zero(); 750 /* sh_forward_html_write(); */ 746 751 #endif 747 752 … … 1174 1179 FileSchedIn = NULL; 1175 1180 *status = 0; 1176 return 0;1181 return NULL; 1177 1182 } 1178 1183 … … 1722 1727 (void) sh_files_setrec(); 1723 1728 (void) sh_files_test_setup(); 1729 sh_audit_commit (); 1724 1730 1725 1731 /* -------- NICE LEVEL --------- … … 1858 1864 (void) sh_files_setrec(); 1859 1865 (void) sh_files_test_setup(); 1866 sh_audit_commit (); 1867 1868 fprintf(stderr, "FIXME: %d\n", (int) sh.fileCheck.alarm_interval); 1869 fprintf(stderr, "FIXME: FileSchedOne %s\n", 1870 FileSchedOne == NULL ? "NULL" : "NOT NULL"); 1871 fprintf(stderr, "FIXME: FileSchedTwo %s\n", 1872 FileSchedTwo == NULL ? "NULL" : "NOT NULL"); 1873 1860 1874 1861 1875 if (0 != sh.flag.nice) -
trunk/src/samhain_setpwd.c
r212 r415 279 279 if (strlen(argv[3]) != 16) 280 280 { 281 fprintf (stdout, _("ERROR <new_password> %s has not exactly 16 chars\n"), 282 argv[0]); 281 fprintf (stdout, 282 _("ERROR <new_password> |%s| has not exactly 16 chars\n"), 283 argv[3]); 283 284 fflush(stdout); 284 285 return EXIT_FAILURE; -
trunk/src/sh_audit.c
r373 r415 211 211 if (p >= 0) 212 212 { 213 char c ommand[64];214 215 sl_snprintf(c ommand, sizeof(command), _("%s -D -k samhain"),213 char ctl[64]; 214 215 sl_snprintf(ctl, sizeof(ctl), _("%s -D -k samhain"), 216 216 _(actl_paths[p])); 217 217 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, … … 219 219 _("Deleting audit daemon rules with key samhain"), 220 220 _("sh_audit_delete_all") ); 221 sh_ext_system(command); 222 } 223 return; 224 } 225 226 void sh_audit_mark (const char * file) 221 222 sl_strlcpy(ctl, _(actl_paths[p]), sizeof(ctl)); 223 sh_ext_system(ctl, ctl, "-D", "-k", _("samhain"), NULL); 224 } 225 return; 226 } 227 228 static void sh_audit_mark_int (const char * file) 227 229 { 228 230 static int flushRules = 0; … … 243 245 char * command = SH_ALLOC(len); 244 246 char * safe; 247 char ctl[64]; 245 248 246 249 sl_snprintf(command, len, _("%s -w %s -p wa -k samhain"), … … 255 258 SH_FREE(safe); 256 259 257 sh_ext_system(command); 258 } 259 return; 260 } 261 260 sl_strlcpy(ctl, _(actl_paths[p]), sizeof(ctl)); 261 sl_strlcpy(command, file, len); 262 263 sh_ext_system(ctl, ctl, "-w", command, "-p", "wa", "-k", _("samhain"), NULL); 264 265 SH_FREE(command); 266 } 267 return; 268 } 269 270 struct aud_list { 271 char * file; 272 struct aud_list * next; 273 }; 274 275 struct aud_list * mark_these = NULL; 276 277 static void add_this (char * file) 278 { 279 struct aud_list * this = SH_ALLOC(sizeof(struct aud_list)); 280 this->file = sh_utils_strdup(file); 281 this->next = mark_these; 282 return; 283 } 284 285 static int test_exchange (struct aud_list * this, char * file) 286 { 287 size_t len0 = sl_strlen(this->file); 288 size_t len1 = sl_strlen(file); 289 int ret = -1; 290 291 if (len0 == len1) 292 { 293 return strcmp(this->file, file); 294 } 295 else 296 { 297 char * s0 = SH_ALLOC(len0 + 2); 298 char * s1 = SH_ALLOC(len1 + 2); 299 300 sl_strlcpy(s0, this->file, len0 + 2); 301 sl_strlcpy(s1, file, len1 + 2); 302 303 if (s0 < s1) 304 { 305 sl_strlcat(s0, "/", len0 + 2); 306 ret = strncmp(s0, s1, len0 + 1); 307 } 308 else 309 { 310 sl_strlcat(s1, "/", len1 + 2); 311 if (0 == strncmp(s0, s1, len1 + 1)) 312 { 313 SH_FREE(this->file); 314 this->file = sh_utils_strdup(file); 315 ret = 0; 316 } 317 } 318 SH_FREE(s0); 319 SH_FREE(s1); 320 } 321 322 return ret; 323 } 324 325 void sh_audit_mark (char * file) 326 { 327 struct aud_list * all = mark_these; 328 struct aud_list * this = mark_these; 329 330 if (!mark_these) { 331 add_this (file); 332 return; 333 } 334 335 while (this) 336 { 337 if (0 == test_exchange(this, file)) 338 return; 339 this = this->next; 340 } 341 342 add_this (file); 343 return; 344 } 345 346 void sh_audit_commit () 347 { 348 struct aud_list * next; 349 struct aud_list * this = mark_these; 350 351 mark_these = NULL; 352 353 while (this) 354 { 355 sh_audit_mark_int (this->file); 356 next = this->next; 357 SH_FREE(this->file); 358 SH_FREE(this); 359 this = next; 360 } 361 362 } 262 363 263 364 static int sh_audit_checkdaemon() … … 381 482 return; 382 483 } 484 void sh_audit_commit () 485 { 486 return; 487 } 383 488 #endif 384 489 -
trunk/src/sh_extern.c
r400 r415 847 847 } 848 848 849 int sh_ext_popen_init (sh_tas_t * task, char * command) 850 { 851 int status; 852 849 static void task_init (sh_tas_t * task) 850 { 853 851 sh_ext_tas_init(task); 854 852 … … 858 856 _("/sbin:/bin:/usr/sbin:/usr/bin:/usr/ucb")); 859 857 (void) sh_ext_tas_add_envv (task, _("IFS"), " \n\t"); 858 860 859 if (sh.timezone != NULL) 861 860 { 862 861 (void) sh_ext_tas_add_envv(task, "TZ", sh.timezone); 863 862 } 863 return; 864 } 865 866 int sh_ext_popen_init (sh_tas_t * task, char * command, char * argv0, ...) 867 { 868 va_list vl; 869 int status; 870 871 task_init (task); 864 872 865 sh_ext_tas_command(task, _("/bin/sh")); 866 867 (void) sh_ext_tas_add_argv(task, _("/bin/sh")); 868 (void) sh_ext_tas_add_argv(task, _("-c")); 869 (void) sh_ext_tas_add_argv(task, command); 870 873 if (!argv0) 874 { 875 sh_ext_tas_command(task, _("/bin/sh")); 876 877 (void) sh_ext_tas_add_argv(task, _("/bin/sh")); 878 (void) sh_ext_tas_add_argv(task, _("-c")); 879 (void) sh_ext_tas_add_argv(task, command); 880 } 881 else 882 { 883 char * s; 884 885 sh_ext_tas_command(task, command); 886 887 (void) sh_ext_tas_add_argv(task, argv0); 888 889 va_start (vl, argv0); 890 s = va_arg (vl, char * ); 891 while (s != NULL) 892 { 893 (void) sh_ext_tas_add_argv(task, s); 894 s = va_arg (vl, char * ); 895 } 896 va_end (vl); 897 898 } 871 899 task->rw = 'r'; 872 900 task->fork_twice = S_FALSE; … … 879 907 /* Execute a system command */ 880 908 881 int sh_ext_system (char * command )909 int sh_ext_system (char * command, char * argv0, ...) 882 910 { 883 911 sh_tas_t task; 884 912 int status; 913 va_list vl; 914 char * s; 885 915 886 916 SL_ENTER(_("sh_ext_system")); 887 917 888 status = sh_ext_popen_init (&task, command); 918 task_init (&task); 919 920 sh_ext_tas_command(&task, command); 921 922 (void) sh_ext_tas_add_argv(&task, argv0); 923 924 va_start (vl, argv0); 925 s = va_arg (vl, char * ); 926 while (s != NULL) 927 { 928 (void) sh_ext_tas_add_argv(&task, s); 929 s = va_arg (vl, char * ); 930 } 931 va_end (vl); 932 933 task.rw = 'r'; 934 task.fork_twice = S_FALSE; 935 936 status = sh_ext_popen(&task); 889 937 890 938 if (status != 0) … … 915 963 SL_ENTER(_("sh_ext_popen_str")); 916 964 917 status = sh_ext_popen_init (&task, command );965 status = sh_ext_popen_init (&task, command, NULL, NULL); 918 966 919 967 if (status != 0) -
trunk/src/sh_getopt.c
r367 r415 401 401 printf (_("Client executable (port %d)"), SH_DEFAULT_PORT); ++num; 402 402 #endif 403 #if defined(SH_WITH_ CLIENT)403 #if defined(SH_WITH_SERVER) 404 404 if (num > 0) fputc ('\n', stdout); 405 405 printf (_("Server executable (port %d, user %s)"), -
trunk/src/sh_html.c
r383 r415 503 503 } 504 504 505 int sh_html_zero() 506 { 507 long fd; 508 509 SL_ENTER(_("sh_html_zero")); 510 511 if (0 != (fd = tf_trust_check (DEFAULT_HTML_FILE, SL_YESPRIV))) 512 { 513 SL_RETURN((-1), _("sh_html_zero")); 514 } 515 516 fd = sl_open_write_trunc (FIL__, __LINE__, DEFAULT_HTML_FILE, SL_YESPRIV); 517 518 if (SL_ISERROR(fd)) 519 { 520 SL_RETURN((-1), _("sh_html_zero")); 521 } 522 523 sh_html_head(fd); 524 sh_html_foot(fd); 525 526 sl_close(fd); 527 528 SL_RETURN((0), _("sh_html_zero")); 529 } 530 505 531 /* SH_WITH_SERVER */ 506 532 #endif -
trunk/src/sh_log_check.c
r379 r415 915 915 entry = SH_ALLOC(sizeof(struct task_entry)); 916 916 917 status = sh_ext_popen_init (&(entry->task), logfile->filename );917 status = sh_ext_popen_init (&(entry->task), logfile->filename, logfile->filename, NULL); 918 918 if (0 == status) 919 919 { -
trunk/src/sh_unix.c
r411 r415 1519 1519 #ifdef WITH_ORACLE 1520 1520 /* 1521 * Skip the ORACLE_HOME environment variable; Oracle may need it. 1521 * Skip the ORACLE_HOME and TNS_ADMIN environment variables; 1522 * Oracle may need them. 1522 1523 */ 1523 1524 if (0 == sl_strncmp((*env), _("ORACLE_HOME="), 12)) 1525 { 1526 ++(env); 1527 continue; 1528 } 1529 if (0 == sl_strncmp((*env), _("TNS_ADMIN="), 10)) 1524 1530 { 1525 1531 ++(env);
Note:
See TracChangeset
for help on using the changeset viewer.