diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-07-23 08:02:21 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-07-23 08:02:21 +0000 |
| commit | 7810b15cfd35f0defc4bec25cc2072e39306a2d6 (patch) | |
| tree | 9d5673c7b05e5d969c0eaacebdde01460c9c2d70 | |
| parent | 2a462baead6ed9925c5e86578b8381f1b905ae34 (diff) | |
| download | btpd-7810b15cfd35f0defc4bec25cc2072e39306a2d6.tar.gz btpd-7810b15cfd35f0defc4bec25cc2072e39306a2d6.zip | |
Add the '--ipcprot' option to change the protection mode of the command
socket. From Arnaud Bergeron.
| -rw-r--r-- | btpd/cli_if.c | 2 | ||||
| -rw-r--r-- | btpd/main.c | 8 | ||||
| -rw-r--r-- | btpd/opts.c | 1 | ||||
| -rw-r--r-- | btpd/opts.h | 1 |
4 files changed, 11 insertions, 1 deletions
diff --git a/btpd/cli_if.c b/btpd/cli_if.c index 017a386..1473bc3 100644 --- a/btpd/cli_if.c +++ b/btpd/cli_if.c @@ -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); diff --git a/btpd/main.c b/btpd/main.c index 6dd9bf3..42df946 100644 --- a/btpd/main.c +++ b/btpd/main.c @@ -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(); } diff --git a/btpd/opts.c b/btpd/opts.c index 1b77c2a..97a8045 100644 --- a/btpd/opts.c +++ b/btpd/opts.c @@ -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; diff --git a/btpd/opts.h b/btpd/opts.h index 688c5fe..7e27051 100644 --- a/btpd/opts.h +++ b/btpd/opts.h @@ -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 |