Browse code

- warning fixes on freebsd

Andrei Pelinescu-Onciul authored on 01/11/2003 18:56:58
Showing 1 changed files
... ...
@@ -58,8 +58,6 @@
58 58
  *  2003-01-29  new built-in fifo commands: arg and pwd (jiri)
59 59
  *  2003-10-07  fifo security fixes: permissions, always delete old fifo,
60 60
  *               reply fifo checks -- added fifo_check (andrei)
61
- *  2003-10-13  addef fifo_dir for reply fifos (andrei)
62
- *  2003-10-30  DB interface exported via FIFO (bogdan)
63 61
  */
64 62
 
65 63
 
... ...
@@ -88,13 +86,10 @@
88 86
 #include "mem/mem.h"
89 87
 #include "sr_module.h"
90 88
 #include "pt.h"
91
-#include "db/db_fifo.h"
92 89
 
93 90
 /* FIFO server vars */
94 91
 char *fifo=0; /* FIFO name */
95
-char* fifo_dir=DEFAULT_FIFO_DIR; /* dir where reply fifos are allowed */
96 92
 int fifo_mode=S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP ;
97
-char *fifo_db_url = 0;
98 93
 pid_t fifo_pid;
99 94
 /* file descriptors */
100 95
 static int fifo_read=0;
... ...
@@ -291,14 +286,14 @@ static char *trim_filename( char * file )
291 286
 			, file);
292 287
 		return 0;
293 288
 	}
294
-	prefix_len=strlen(fifo_dir); fn_len=strlen(file);
289
+	prefix_len=strlen(FIFO_DIR); fn_len=strlen(file);
295 290
 	new_fn=pkg_malloc(prefix_len+fn_len+1);
296 291
 	if (new_fn==0) {
297 292
 		LOG(L_ERR, "ERROR: trim_filename: no mem\n");
298 293
 		return 0;
299 294
 	}
300 295
 
301
-	memcpy(new_fn, fifo_dir, prefix_len);
296
+	memcpy(new_fn, FIFO_DIR, prefix_len);
302 297
 	memcpy(new_fn+prefix_len, file, fn_len );
303 298
 	new_fn[prefix_len+fn_len]=0;
304 299
 
... ...
@@ -349,8 +344,8 @@ static int fifo_check(int fd, char* fname)
349 344
 	 */
350 345
 	if ((lst.st_dev!=fst.st_dev)||(lst.st_ino!=fst.st_ino)){
351 346
 		LOG(L_ERR, "ERROR: security: fifo_check: inode/dev number differ"
352
-				": %ld %ld (%s)\n",
353
-				 fst.st_ino, lst.st_ino, fname);
347
+				": %d %d (%s)\n",
348
+				 (int)fst.st_ino, (int)lst.st_ino, fname);
354 349
 		return -1;
355 350
 	}
356 351
 	/* success */
... ...
@@ -466,9 +461,6 @@ static void fifo_server(FILE *fifo_stream)
466 461
 
467 462
 	file_sep=command=file=0;
468 463
 
469
-	/* register a diagnostic FIFO command */
470
-	register_core_fifo();
471
-
472 464
 	while(1) {
473 465
 
474 466
 		/* commands must look this way ':<command>:[filename]' */
... ...
@@ -530,7 +522,6 @@ static void fifo_server(FILE *fifo_stream)
530 522
 consume:
531 523
 		if (file) { pkg_free(file); file=0;}
532 524
 		consume_request(fifo_stream);
533
-		DBG("**** done consume\n");
534 525
 	}
535 526
 }
536 527
 
... ...
@@ -558,9 +549,9 @@ int open_fifo_server()
558 549
 			LOG(L_ERR, "ERROR: open_fifo_server: cannot delete old fifo (%s):"
559 550
 					" %s\n", fifo, strerror(errno));
560 551
 			return -1;
561
-			}
562 552
 		}
563
-		/* create FIFO ... */
553
+	}
554
+	 /* create FIFO ... */
564 555
 		LOG(L_DBG, "DEBUG: open_fifo_server: FIFO stat failed: %s\n",
565 556
 			strerror(errno));
566 557
 		if ((mkfifo(fifo, fifo_mode)<0)) {
... ...
@@ -820,54 +811,36 @@ static int ps_fifo_cmd(FILE *stream, char *response_file )
820 811
 int register_core_fifo()
821 812
 {
822 813
 	if (register_fifo_cmd(print_fifo_cmd, FIFO_PRINT, 0)<0) {
823
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_PRINT);
814
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_PRINT);
824 815
 		return -1;
825 816
 	}
826 817
 	if (register_fifo_cmd(uptime_fifo_cmd, FIFO_UPTIME, 0)<0) {
827
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_UPTIME);
818
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_UPTIME);
828 819
 		return -1;
829 820
 	}
830 821
 	if (register_fifo_cmd(print_version_cmd, FIFO_VERSION, 0)<0) {
831
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n",FIFO_VERSION);
822
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_VERSION);
832 823
 		return -1;
833 824
 	}
834 825
 	if (register_fifo_cmd(pwd_cmd, FIFO_PWD, 0)<0) {
835
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_PWD);
826
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_PWD);
836 827
 		return -1;
837 828
 	}
838 829
 	if (register_fifo_cmd(arg_cmd, FIFO_ARG, 0)<0) {
839
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_ARG);
830
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_ARG);
840 831
 		return -1;
841 832
 	}
842 833
 	if (register_fifo_cmd(which_fifo_cmd, FIFO_WHICH, 0)<0) {
843
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_WHICH);
834
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_WHICH);
844 835
 		return -1;
845 836
 	}
846 837
 	if (register_fifo_cmd(ps_fifo_cmd, FIFO_PS, 0)<0) {
847
-		LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_PS);
838
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_PS);
848 839
 		return -1;
849 840
 	}
850 841
 	if (register_fifo_cmd(kill_fifo_cmd, FIFO_KILL, 0)<0) {
851
-		LOG(L_CRIT, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_KILL);
842
+		LOG(L_CRIT, "unable to register '%s' FIFO cmd\n", FIFO_KILL);
852 843
 		return -1;
853 844
 	}
854
-	if (fifo_db_url==0) {
855
-		LOG(L_WARN,"WARNING: no fifo_db_url given - "
856
-			"fifo DB commands disabled!\n");
857
-	} else if ( bind_dbmod(fifo_db_url)==0 ) {
858
-		if (register_fifo_cmd(db_fifo_cmd, FIFO_DB, 0)<0) {
859
-			LOG(L_ERR, "ERROR: unable to register '%s' FIFO cmd\n", FIFO_DB);
860
-			return -1;
861
-		} else {
862
-			if ( (fifo_db_con=db_init( fifo_db_url ))==0) {
863
-				/* connection failed */
864
-			LOG(L_ERR,"ERROR: unable to connect to database -> "
865
-				"fifo DB commands disabled!\n");
866
-			}
867
-		}
868
-	} else {
869
-		LOG(L_WARN,"WARNING: unable to find any db module - "
870
-			"fifo DB commands disabled!\n");
871
-	}
872 845
 	return 1;
873 846
 }