Changeset 507


Ignore:
Timestamp:
07/01/09 16:05:12 (3 years ago)
Author:
eagle
Message:

pid file is created optionally,
OC stays in foreground in Cygwin by default.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/AUTHORS

    r472 r507  
    44  - Debian package 
    55  - Ubuntu package 
     6* Basic conceptual ideas, Mac OSX Testing: Daniel Haslinger <creo _at_ cypherpunk.at> 
    67 
  • trunk/ChangeLog

    r506 r507  
    11* version 0.2.0 
     2 - syslog messages contain name and PID 
    23 
    34* version 0.1.13 
  • trunk/configure

    r506 r507  
    11#! /bin/sh 
    22# Guess values for system-dependent variables and create Makefiles. 
    3 # Generated by GNU Autoconf 2.61 for onioncat 0.2.0.r504. 
     3# Generated by GNU Autoconf 2.61 for onioncat 0.2.0.r506. 
    44# 
    55# Report bugs to <rahra@cypherpunk.at>. 
     
    575575PACKAGE_NAME='onioncat' 
    576576PACKAGE_TARNAME='onioncat' 
    577 PACKAGE_VERSION='0.2.0.r504' 
    578 PACKAGE_STRING='onioncat 0.2.0.r504' 
     577PACKAGE_VERSION='0.2.0.r506' 
     578PACKAGE_STRING='onioncat 0.2.0.r506' 
    579579PACKAGE_BUGREPORT='rahra@cypherpunk.at' 
    580580 
     
    11791179  # This message is too long to be a string in the A/UX 3.1 sh. 
    11801180  cat <<_ACEOF 
    1181 \`configure' configures onioncat 0.2.0.r504 to adapt to many kinds of systems. 
     1181\`configure' configures onioncat 0.2.0.r506 to adapt to many kinds of systems. 
    11821182 
    11831183Usage: $0 [OPTION]... [VAR=VALUE]... 
     
    12491249if test -n "$ac_init_help"; then 
    12501250  case $ac_init_help in 
    1251      short | recursive ) echo "Configuration of onioncat 0.2.0.r504:";; 
     1251     short | recursive ) echo "Configuration of onioncat 0.2.0.r506:";; 
    12521252   esac 
    12531253  cat <<\_ACEOF 
     
    13381338if $ac_init_version; then 
    13391339  cat <<\_ACEOF 
    1340 onioncat configure 0.2.0.r504 
     1340onioncat configure 0.2.0.r506 
    13411341generated by GNU Autoconf 2.61 
    13421342 
     
    13521352running configure, to aid debugging if configure makes a mistake. 
    13531353 
    1354 It was created by onioncat $as_me 0.2.0.r504, which was 
     1354It was created by onioncat $as_me 0.2.0.r506, which was 
    13551355generated by GNU Autoconf 2.61.  Invocation command line was 
    13561356 
     
    20422042# Define the identity of the package. 
    20432043 PACKAGE='onioncat' 
    2044  VERSION='0.2.0.r504' 
     2044 VERSION='0.2.0.r506' 
    20452045 
    20462046 
     
    21932193 
    21942194cat >>confdefs.h <<\_ACEOF 
    2195 #define SVN_REVISION "504" 
     2195#define SVN_REVISION "506" 
    21962196_ACEOF 
    21972197 
     
    49414941# values after options handling. 
    49424942ac_log=" 
    4943 This file was extended by onioncat $as_me 0.2.0.r504, which was 
     4943This file was extended by onioncat $as_me 0.2.0.r506, which was 
    49444944generated by GNU Autoconf 2.61.  Invocation command line was 
    49454945 
     
    49944994cat >>$CONFIG_STATUS <<_ACEOF 
    49954995ac_cs_version="\\ 
    4996 onioncat config.status 0.2.0.r504 
     4996onioncat config.status 0.2.0.r506 
    49974997configured by $0, generated by GNU Autoconf 2.61, 
    49984998  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 
  • trunk/src/ocat.c

    r502 r507  
    8989 
    9090 
    91 int mk_pid_file(void) 
     91int mk_pid_file(uid_t uid) 
    9292{ 
    9393   FILE *f; 
     
    102102   fclose(f); 
    103103   log_debug("pid_file %s created, pid = %d", CNF(pid_file), getpid()); 
     104 
     105   if (chown(CNF(pid_file), uid, 0) == -1) 
     106      log_msg(LOG_ERR, "could not change owner of pid_file \"%s\" to %d: %s", CNF(pid_file), uid, strerror(errno)); 
    104107 
    105108   return 0; 
     
    208211 
    209212   delete_listeners(CNF(oc_listen), CNF(oc_listen_fd), CNF(oc_listen_cnt)); 
     213 
     214   if (CNF(create_pid_file) && (unlink(CNF(pid_file)) == -1)) 
     215      log_msg(LOG_ERR, "could not remove pid file \"%s\": %s", CNF(pid_file), strerror(errno)); 
    210216} 
    211217 
     
    275281 
    276282         case 'P': 
    277             CNF(pid_file) = optarg; 
     283            CNF(create_pid_file) = 1; 
     284            if (optarg[0] == '-') 
     285               optind--; 
     286            else 
     287               CNF(pid_file) = optarg; 
    278288            break; 
    279289 
     
    326336      CNF(logf) = stderr; 
    327337  
    328    (void) open_logfile(); 
     338   if ((open_logfile() == -1) && !CNF(logf)) 
     339      openlog(PACKAGE_NAME, LOG_NDELAY | LOG_PID, LOG_DAEMON); 
    329340 
    330341   // init main thread 
     
    439450 
    440451   // create pid_file 
    441    mk_pid_file(); 
     452   if (CNF(create_pid_file)) 
     453      mk_pid_file(pwd->pw_uid); 
    442454 
    443455   if (!runasroot && !getuid()) 
  • trunk/src/ocat.h

    r500 r507  
    277277   uint8_t ocat_hwaddr[ETHER_ADDR_LEN]; 
    278278   char *pid_file; 
     279   int create_pid_file; 
    279280   char *logfn; 
    280281   FILE *logf; 
  • trunk/src/ocatctrl.c

    r499 r507  
    161161            if (peer->tcpfd == cfd) 
    162162            { 
    163                log_msg(LOG_INFO | LOG_FCONN, "close request for %d", cfd); 
    164163               oe_close(cfd); 
    165164               delete_peer(peer); 
     165               log_msg(LOG_INFO | LOG_FCONN, "%d was successfully closed up on user request", cfd); 
    166166               break; 
    167167            } 
  • trunk/src/ocatsetup.c

    r497 r507  
    6161#endif 
    6262   {0x00, 0x00, 0x6c, 0x00, 0x00, 0x00},   // ocat_hwaddr (OnionCat MAC address) 
    63    PID_FILE, 
     63   PID_FILE,                               // pid_file 
     64   0,                                      // create_pid_file 
    6465   NULL, NULL,                             // logfile 
     66#ifdef __CYGWIN__ 
     67   0, 
     68#else 
    6569   1,                                      // daemon 
     70#endif 
    6671   { 
    6772      /* 
     
    232237         setup_.daemon, 
    233238         t / (3600 * 24), t / 3600 % 24, t / 60 % 60, 
    234          strlen(setup_.version), VERSION_STRING_LEN, setup_.version, 
     239         (int) strlen(setup_.version), VERSION_STRING_LEN, setup_.version, 
    235240         setup_.sizeof_setup, 
    236241         setup_.term_req 
Note: See TracChangeset for help on using the changeset viewer.