File tree Expand file tree Collapse file tree 4 files changed +21
-6
lines changed
Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ To use fiche you have to have netcat installed. You probably already have it - t
137137
138138```
139139usage: fiche [ -D6epbsdSolBuw] .
140- [ -d domain] [ -p port] [ -s slug size]
140+ [ -d domain] [ -L listen_addr ] [ - p port] [ -s slug size]
141141 [ -o output directory] [ -B buffer size] [ -u user name]
142142 [ -l log file] [ -b banlist] [ -w whitelist] [ -S]
143143```
Original file line number Diff line number Diff line change @@ -197,6 +197,8 @@ void fiche_init(Fiche_Settings *settings) {
197197 "example.com" ,
198198 // output dir
199199 "code" ,
200+ // listen_addr
201+ "0.0.0.0" ,
200202 // port
201203 9999 ,
202204 // slug length
@@ -442,7 +444,7 @@ static int start_server(Fiche_Settings *settings) {
442444 // Prepare address and port handler
443445 struct sockaddr_in address ;
444446 address .sin_family = AF_INET ;
445- address .sin_addr .s_addr = INADDR_ANY ;
447+ address .sin_addr .s_addr = inet_addr ( settings -> listen_addr ) ;
446448 address .sin_port = htons (settings -> port );
447449
448450 // Bind to port
@@ -457,7 +459,8 @@ static int start_server(Fiche_Settings *settings) {
457459 return -1 ;
458460 }
459461
460- print_status ("Server started listening on port: %d." , settings -> port );
462+ print_status ("Server started listening on: %s:%d." ,
463+ settings -> listen_addr , settings -> port );
461464 print_separator ();
462465
463466 // Run dispatching loop
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ typedef struct Fiche_Settings {
4343 */
4444 char * output_dir_path ;
4545
46+ /**
47+ * @brief Address on which fiche is waiting for connections
48+ */
49+ char * listen_addr ;
50+
4651 /**
4752 * @brief Port on which fiche is waiting for connections
4853 */
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ int main(int argc, char **argv) {
4444
4545 // Parse input arguments
4646 int c ;
47- while ((c = getopt (argc , argv , "D6eSp :b:s:d:o:l:B:u:w:" )) != -1 ) {
47+ while ((c = getopt (argc , argv , "D6eSL:p :b:s:d:o:l:B:u:w:" )) != -1 ) {
4848 switch (c ) {
4949
5050 // domain
@@ -61,6 +61,13 @@ int main(int argc, char **argv) {
6161 }
6262 break ;
6363
64+ // listen_addr
65+ case 'L' :
66+ {
67+ fs .listen_addr = optarg ;
68+ }
69+ break ;
70+
6471 // slug size
6572 case 's' :
6673 {
@@ -120,8 +127,8 @@ int main(int argc, char **argv) {
120127 // Display help in case of any unsupported argument
121128 default :
122129 {
123- printf ("usage: fiche [-dpsSoBulbw ].\n" );
124- printf (" [-d domain] [-p port] [-s slug size]\n" );
130+ printf ("usage: fiche [-dLpsSoBulbw ].\n" );
131+ printf (" [-d domain] [-L listen_addr] [- p port] [-s slug size]\n" );
125132 printf (" [-o output directory] [-B buffer size] [-u user name]\n" );
126133 printf (" [-l log file] [-b banlist] [-w whitelist] [-S]\n" );
127134 return 0 ;
You can’t perform that action at this time.
0 commit comments