Changeset 416 for trunk/src/ocat.c


Ignore:
Timestamp:
Jan 4, 2009, 4:47:12 PM (8 years ago)
Author:
eagle
Message:

man page updated
support of random local addresses added (option -R)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ocat.c

    r413 r416  
    3838         "   -P <pid_file>         create pid file at location of <pid_file> (default = %s)\n"
    3939         "   -r                    run as root, i.e. do not change uid/gid\n"
     40         "   -R                    generate a random local onion URL\n"
    4041         "   -s <port>             set hidden service virtual port, default = %d\n"
    4142         "   -t [<ip>:]<port>      set Tor SOCKS address and port, default = 127.0.0.1:%d\n"
     
    4950         OCAT_DIR, OCAT_CONNECT_LOG, CNF(create_clog), CNF(debug_level), OCAT_LISTEN_PORT,
    5051         CNF(pid_file),
    51          CNF(ocat_dest_port), CNF(socks_dst)->sin_port,
     52         CNF(ocat_dest_port), ntohs(CNF(socks_dst)->sin_port),
    5253#ifndef WITHOUT_TUN
    5354         TUN_DEV,
     
    131132      usage(argv[0]), exit(1);
    132133
    133    while ((c = getopt(argc, argv, "abCd:f:hriopl:t:T:s:u:4L:P:")) != -1)
     134   while ((c = getopt(argc, argv, "abCd:f:hrRiopl:t:T:s:u:4L:P:")) != -1)
    134135      switch (c)
    135136      {
     
    184185            runasroot = 1;
    185186            CNF(usrname) = "root";
     187            break;
     188
     189         case 'R':
     190            CNF(rand_addr) = 1;
    186191            break;
    187192
     
    215220      }
    216221
    217    if (!argv[optind])
     222   if (!CNF(rand_addr) && !argv[optind])
    218223      usage(argv[0]), exit(1);
    219224
     
    234239   }
    235240
     241   // copy onion-URL from command line
     242   if (!CNF(rand_addr))
     243      strncpy(CNF(onion_url), argv[optind], ONION_NAME_SIZE);
     244   // ...or generate a random one
     245   else
     246      rand_onion(CNF(onion_url));
     247
    236248   // convert parameter to IPv6 address
    237    strncpy(CNF(onion_url), argv[optind], ONION_NAME_SIZE);
    238249   if ((s = strchr(CNF(onion_url), '.')))
    239250         *s = '\0';
Note: See TracChangeset for help on using the changeset viewer.