Procházet zdrojové kódy

Add the '--ipcprot' option to change the protection mode of the command

socket. From Arnaud Bergeron.
master
Richard Nyberg před 18 roky
rodič
revize
7810b15cfd
4 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. +1
    -1
      btpd/cli_if.c
  2. +8
    -0
      btpd/main.c
  3. +1
    -0
      btpd/opts.c
  4. +1
    -0
      btpd/opts.h

+ 1
- 1
btpd/cli_if.c Zobrazit soubor

@@ -274,7 +274,7 @@ ipc_init(void)
btpd_err("bind: %s\n", strerror(errno));
}

if (chmod(addr.sun_path, 0600) == -1)
if (chmod(addr.sun_path, ipcprot) == -1)
btpd_err("chmod: %s (%s).\n", addr.sun_path, strerror(errno));
listen(sd, 4);
set_nonblocking(sd);


+ 8
- 0
btpd/main.c Zobrazit soubor

@@ -89,6 +89,10 @@ usage(void)
"--help\n"
"\tShow this text.\n"
"\n"
"--ipcprot prot\n"
"\tChange the protection mode on the command socket to prot.\n"
"\tThe mode must be specified in octal. Default is 0600.\n"
"\n"
"--logfile file\n"
"\tWhere to put the logfile. By default it's put in the btpd dir.\n"
"\n"
@@ -129,6 +133,7 @@ static struct option longopts[] = {
{ "max-peers", required_argument, &longval, 5 },
{ "no-daemon", no_argument, &longval, 6 },
{ "logfile", required_argument, &longval, 7 },
{ "ipcprot", required_argument, &longval, 8 },
{ "help", no_argument, &longval, 128 },
{ NULL, 0, NULL, 0 }
};
@@ -174,6 +179,9 @@ main(int argc, char **argv)
case 7:
log = optarg;
break;
case 8:
ipcprot = strtol(optarg, NULL, 8);
break;
default:
usage();
}


+ 1
- 0
btpd/opts.c Zobrazit soubor

@@ -12,3 +12,4 @@ unsigned net_bw_limit_in;
unsigned net_bw_limit_out;
int net_port = 6881;
off_t cm_alloc_size = 2048 * 1024;
int ipcprot = 0600;

+ 1
- 0
btpd/opts.h Zobrazit soubor

@@ -9,5 +9,6 @@ extern unsigned net_bw_limit_in;
extern unsigned net_bw_limit_out;
extern int net_port;
extern off_t cm_alloc_size;
extern int ipcprot;

#endif

Načítá se…
Zrušit
Uložit