|
@@ -214,6 +214,7 @@ static void show_help ()
|
214
|
214
|
"Options:\n"
|
215
|
215
|
" -s<file> read secrets from file (required)\n"
|
216
|
216
|
" -d<domain> set domain name for rewrite (required)\n"
|
|
217
|
+ " -a<char> set first separator character which can be one of: -=+ (default: =)\n"
|
217
|
218
|
" -f<port> set port for the forward SRS lookup (default: 10001)\n"
|
218
|
219
|
" -r<port> set port for the reverse SRS lookup (default: 10002)\n"
|
219
|
220
|
" -p<pidfile> write process ID to pidfile (default: none)\n"
|
|
@@ -240,6 +241,7 @@ int main (int argc, char **argv)
|
240
|
241
|
int daemonize = FALSE;
|
241
|
242
|
char *forward_service = NULL, *reverse_service = NULL,
|
242
|
243
|
*user = NULL, *domain = NULL, *chroot_dir = NULL;
|
|
244
|
+ char separator = '=';
|
243
|
245
|
int forward_sock, reverse_sock;
|
244
|
246
|
char *secret_file = NULL, *pid_file = NULL;
|
245
|
247
|
FILE *pf = NULL, *sf = NULL;
|
|
@@ -257,7 +259,7 @@ int main (int argc, char **argv)
|
257
|
259
|
tmp = strrchr(argv[0], '/');
|
258
|
260
|
if (tmp) self = strdup(tmp + 1); else self = strdup(argv[0]);
|
259
|
261
|
|
260
|
|
- while ((opt = getopt(argc, argv, "46d:f:r:s:u:t:p:c:X::Dhev")) != -1) {
|
|
262
|
+ while ((opt = getopt(argc, argv, "46d:a:f:r:s:u:t:p:c:X::Dhev")) != -1) {
|
261
|
263
|
switch (opt) {
|
262
|
264
|
case '?':
|
263
|
265
|
return EXIT_FAILURE;
|
|
@@ -270,6 +272,9 @@ int main (int argc, char **argv)
|
270
|
272
|
case 'd':
|
271
|
273
|
domain = strdup(optarg);
|
272
|
274
|
break;
|
|
275
|
+ case 'a':
|
|
276
|
+ separator = *optarg;
|
|
277
|
+ break;
|
273
|
278
|
case 'f':
|
274
|
279
|
forward_service = strdup(optarg);
|
275
|
280
|
break;
|
|
@@ -318,6 +323,8 @@ int main (int argc, char **argv)
|
318
|
323
|
case 'e':
|
319
|
324
|
if ( getenv("SRS_DOMAIN") != NULL )
|
320
|
325
|
domain = strdup(getenv("SRS_DOMAIN"));
|
|
326
|
+ if ( getenv("SRS_SEPARATOR") != NULL )
|
|
327
|
+ separator = *getenv("SRS_SEPARATOR");
|
321
|
328
|
if ( getenv("SRS_FORWARD_PORT") != NULL )
|
322
|
329
|
forward_service = strdup(getenv("SRS_FORWARD_PORT"));
|
323
|
330
|
if ( getenv("SRS_REVERSE_PORT") != NULL )
|
|
@@ -363,6 +370,11 @@ int main (int argc, char **argv)
|
363
|
370
|
return EXIT_FAILURE;
|
364
|
371
|
}
|
365
|
372
|
|
|
373
|
+ if (separator != '=' && separator != '+' && separator != '-') {
|
|
374
|
+ fprintf (stderr, "%s: SRS separator character must be one of '=+-'\n", self);
|
|
375
|
+ return EXIT_FAILURE;
|
|
376
|
+ }
|
|
377
|
+
|
366
|
378
|
/* The stuff we do first may not be possible from within chroot or without privileges */
|
367
|
379
|
|
368
|
380
|
/* Open pid file for writing (the actual process ID is filled in later) */
|
|
@@ -455,7 +467,8 @@ int main (int argc, char **argv)
|
455
|
467
|
srs_add_secret (srs, secret);
|
456
|
468
|
}
|
457
|
469
|
fclose (sf);
|
458
|
|
- srs_set_separator (srs, '+');
|
|
470
|
+
|
|
471
|
+ srs_set_separator (srs, separator);
|
459
|
472
|
|
460
|
473
|
fds[0].fd = forward_sock;
|
461
|
474
|
fds[0].events = POLLIN;
|