siproxd and cygwin

[email protected] Fri, 7 Jan 2005 14:09:17 +0100
Newsgroups gmane.network.siproxd
Message-ID <OF992398CB.4EBA44B6-ONC1256F82.00482E3F-C1256F82.004842E9@mw-eb.de>
We have installed and tested siproxd on Win2000 and WinXP with cygwin. 
Runs stable.
We have made the following changes, shown at the end of the mail:
In configure we have introduced cygwin.
In rtpproxy_relay.c we have exclude checking for uid 0, because with 
cygwin there is no root user with uid 0. You can change in /etc/passwd, 
but this is unsecure, because it is generated from the Windows users and 
after generation random uids are found for the users.
To install siproxd as a Windows service you can use
cygrunsrv -I siproxd -p /usr/local/sbin -c /tmp -t auto -o -a "<parameters 
for siproxd>"
If you have cygwin init installed as service you can start siproxd from 
inittab like in other Unix
compile of libosip2-2.0.6 also worked fine: configure - make - make 
install - ok.
all good work
regards MW
here are the changes.
configure:
$ diff -c3 configure.orig configure
*** configure.orig      Mon Jan  3 16:44:49 2005
--- configure   Mon Jan  3 16:47:11 2005
***************
*** 3313,3318 ****
--- 3313,3328 ----
  echo "$as_me:$LINENO: checking target platform" >&5
  echo $ECHO_N "checking target platform... $ECHO_C" >&6
  case "$target" in
+   *cygwin*)
+     echo "$as_me:$LINENO: result: Cygwin" >&5
+ echo "${ECHO_T}Cygwin" >&6
+
+ cat >>confdefs.h <<\_ACEOF
+ #define _CYGWIN
+ _ACEOF
+
+     ;;
+ case "$target" in
    *-*-linux*)
      echo "$as_me:$LINENO: result: Linux" >&5
  echo "${ECHO_T}Linux" >&6

rtpproxy_relay.c:
$ diff -c3 rtpproxy_relay.c.orig rtpproxy_relay.c
*** rtpproxy_relay.c.orig       Thu Dec 30 12:26:05 2004
--- rtpproxy_relay.c    Thu Dec 30 13:53:05 2004
***************
*** 111,122 ****
--- 111,124 ----
        int uid,euid;
        struct sched_param schedparam;

+ #ifndef _CYGWIN
        uid=getuid();
        euid=geteuid();
        DEBUGC(DBCLASS_RTP,"uid=%i, euid=%i", uid, euid);
        if (uid != euid) seteuid(0);

        if (geteuid()==0) {
+ #endif
  #if defined(HAVE_SCHED_GET_PRIORITY_MAX) && 
defined(HAVE_SCHED_GET_PRIORITY_MI
N)
           int pmin, pmax;
           /* place ourself at 1/3 of the available priority space */
***************
*** 134,144 ****
--- 136,148 ----
           if (sts != 0) {
              ERROR("pthread_setschedparam failed: %s", strerror(errno));
           }
+ #ifndef _CYGWIN
        } else {
           INFO("Unable to use realtime scheduling for RTP proxy");
           INFO("You may want to start siproxd as root and switch UID 
afterwards
");
        }
        if (uid != euid)  seteuid(euid);
+ #endif
     }
  #endif

Mathias Wohlfarth EDV-Beratung
Thomas-Mann-Str.1
53111 Bonn
Tel.    0172 / 53 45 591
        01801 / 777 555 33 01
Fax     0228 / 9469181
Email   [email protected]