diff -Naur ./torque-trunk-3545-cygwin/CHANGELOG ./new-trunk-3545/CHANGELOG --- ./torque-trunk-3545-cygwin/CHANGELOG 2010-03-11 23:42:15.487956000 +0200 +++ ./new-trunk-3545/CHANGELOG 2010-03-23 14:23:49.000000000 +0200 @@ -4,22 +4,22 @@ f - added full support (server-scheduler-mom) for Cygwin (UIIP NAS of Belarus, uiip.bas-net.by) f - architecture and build system changes to support Cygwin (Igor Ilyenko, - uiip.bas-net.by) + UIIP Minsk) b - fixed EINPROGRESS in net_client.c. This signal appears every time of connecting and requires individual processing. The old erroneous processing brought to big network delay, especially on Cygwin. e - improved signal processing after connecting in client_to_svr and added own implementation of bindresvport for OS which lack it (Igor Ilyenko, - uiip.bas-net.by) + UIIP Minsk) f - created permission checking of Windows (Cygwin) users, using mkpasswd, mkgroup and own functions IamRoot, IamUser (Yauheni Charniauski, - uiip.bas-net.by) + UIIP Minsk) f - created permission checking of submited jobs (Vikentsi Lapa, - uiip.bas-net.by) + UIIP Minsk) f - Added the --disable-daemons configure option for start server-sched-mom as Windows services, cygrunsrv.exe goes its into background independently. e - Adapted output of Cygwin's diagnostic information (Yauheni Charniauski, - uiip.bas-net.by) + UIIP Minsk) b - Changed pbsd_main to call daemonize_server early only if high_availability_mode is set. e - removed the very old A_ macros (patch provided by Simon Toth, CESNET z.s.p.o.) diff -Naur ./torque-trunk-3545-cygwin/contrib/AddPrivileges ./new-trunk-3545/contrib/AddPrivileges --- ./torque-trunk-3545-cygwin/contrib/AddPrivileges 2009-12-15 03:29:40.769792000 +0200 +++ ./new-trunk-3545/contrib/AddPrivileges 2010-03-25 18:18:44.245178950 +0200 @@ -1,6 +1,6 @@ #! /bin/sh -### AddPrivileges ver 1.0 19 Nov 2009 ### +### AddPrivileges ver 1.2 17 Mar 2010 ### ### ------------------------------------------------------ ### ### This script creates Passwd&Group files and sets ### ### additional privileges only for Windows users ### @@ -13,20 +13,18 @@ case $OS in cygwin*) ;; - *) echo " Script can run on Cygwin 1.5 only" + *) echo " Script can run on Cygwin only" exit 1;; esac case $1 in - '') - echo " No user's login. Try \`$0 --help' for more information." - exit 1; - ;; + -h | --h*) cat <<\EOF -Usage: AddPrivileges [--help] [--version] UserAdmin [mom] +Usage: AddPrivileges --help | --version or + AddPrivileges --add [mom | SYSTEM] Set additional privileges for Windows (Cygwin) user @@ -34,24 +32,25 @@ Options: --help, -h display this help and exit + --version, -v output version information and exit - UserAdmin login of Windows user - with Computer administrator privileges or - SYSTEM - native Windows user - - mom add privileges for Torque pbs_mom only + --add add privileges + + mom for Torque pbs_mom + SYSTEM for native Windows user EOF exit $? ;; + -v | --v*) echo - echo " AddPrivileges ver 1.0 19 Nov 2009" + echo " AddPrivileges ver 1.2 17 Mar 2010" exit $? ;; -esac + --add) CURRENTU=`whoami` @@ -59,28 +58,36 @@ GROUPF=/etc/group -ADMINGR=544:544 +ADMINGRL=544 +ADMINGRD=512 -mkpasswd -l > $PASSWDF -mkgroup -l -u > $GROUPF +if id -G | grep -q "$ADMINGRD" -chmod 644 $PASSWDF + then + echo " $CURRENTU is a domain administrator" + mkpasswd -l -d > $PASSWDF + mkgroup -l -d -u > $GROUPF; -chmod 644 $GROUPF + elif id -G | grep -q "$ADMINGRL" - -if grep "$ADMINGR" "$GROUPF" | grep -q "$CURRENTU"; - - then echo; + then + echo " $CURRENTU is a local administrator" + mkpasswd -l > $PASSWDF + mkgroup -l -u > $GROUPF; else echo " Current user '$CURRENTU' has not administrator privileges" exit $?; fi -if [ "$1" = "SYSTEM" ]; then +chmod 644 $PASSWDF + +chmod 644 $GROUPF + + +if [ "$2" = "SYSTEM" ]; then echo echo " Passwd&Group files were created" @@ -90,23 +97,16 @@ fi -if grep "$ADMINGR" "$GROUPF" | grep -q $1; - - then echo " $1 has got Computer administrator privileges"; - - else echo " $1 is not Windows user with Computer administrator privileges" - exit $?; -fi - - if [ "$2" = "mom" ]; then - editrights -a SeCreateTokenPrivilege -u $1 + editrights -a SeCreateTokenPrivilege -u "$CURRENTU" + + echo " Set mom's privileges" fi -editrights -a SeServiceLogonRight -u $1 +editrights -a SeServiceLogonRight -u "$CURRENTU" if [[ $? -eq $SUCCESS ]]; then @@ -124,4 +124,11 @@ EOF fi + exit $? + ;; + +esac + +echo " Bad syntax. Try \`$0 --help' for more information." +exit 1; diff -Naur ./torque-trunk-3545-cygwin/README.cygwin ./new-trunk-3545/README.cygwin --- ./torque-trunk-3545-cygwin/README.cygwin 2009-12-15 03:00:51.193994000 +0200 +++ ./new-trunk-3545/README.cygwin 2010-03-25 12:57:50.552053934 +0200 @@ -1,12 +1,10 @@ - - -Tested with the last stable release Cygwin 1.5.25-15 on + + +Tested with the stable release Cygwin 1.5.25-15 on Windows XP Pro and on Windows Server 2003 SE (both 32-bit). -As of July 24, 2009, Cygwin doesn't yet support getaddrinfo() -which means that X11 forwarding won't be built. -Tcl/Tk components are untested. -Interactive jobs are untested. +GUI and Tcl/Tk components are untested +Interactive jobs are untested. Can be used on heterogeneous Torque clusters. Scheduler C is used only. Mail and drmaa are untested. @@ -22,14 +20,13 @@ or as Windows services. - ########################### ### Install Cygwin ### ########################### To install Cygwin, enter into Windows as user . -Browse to http://www.cygwin.com and click the "Install Cygwin Now" link. -Download and run setup.exe. +Browse to http://cygwin.com/win-9x.html and click the "setup-legacy.exe" link. +Download and run setup-legacy.exe. Click through the defaults and under the package selection select the following packages: @@ -37,7 +34,7 @@ automake; cygrunsrv; email; - gcc; + gcc4; make; openssh; sunrpc; @@ -47,15 +44,8 @@ -Setup openssh for and : - - #ssh-host-config - #ssh-user-config - #login - login: - Password: - [SimleUser]#ssh-user-config - +Setup openssh for and using the +ssh-host-config and ssh-user-config comands Adjust an access without password prompting on each host. @@ -67,17 +57,17 @@ Enter into working directory as and execute the following commands: - #./configure --disable-unixsockets + #./configure --disable-unixsockets --disable-gcc-warnings [--disable-daemons] #make #make install The next command must be at the server installation: - #./contrib/AddPrivileges + #./contrib/AddPrivileges --add The next command must be at the mom installation: - #./contrib/AddPrivileges mom + #./contrib/AddPrivileges --add mom The AddPrivileges script creates passwd&group files and adds privileges necessary for normal work Torque components. @@ -85,32 +75,32 @@ Usage of privileges for various start of Torque components is resulted in the table: - ----------------------------------------------------------------------- -! !! ! ! -! Run as !! pbs_server + sched ! pbs_mom ! -! !! ! ! -!===================!!=======================!==========================! -! !! ! ! -! Cygwin daemon !! --- ! SeCreateTokenPrivilege ! -! !! ! ! -!-------------------!!-----------------------!--------------------------! -! !! ! ! -! Windows service !! SeServiceLogonRight ! SeServiceLogonRight ! -! by !! ! SeCreateTokenPrivilege ! -! !! ! ! -!-------------------!!-----------------------!--------------------------! -! !! ! ! -! Windows service !! --- ! --- ! -! by SYSTEM !! ! ! -! on Windows XP !! ! ! -! !! ! ! - ----------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------- +! !! ! ! ! +! Run as !! pbs_server + sched ! pbs_mom ! on Windows subkind ! +! !! ! ! ! +!===================!!=======================!==========================!==========================! +! !! ! ! ! +! Cygwin daemon !! --- ! SeCreateTokenPrivilege ! Windows XP/Server 2003 ! +! !! ! ! ! +!-------------------!!-----------------------!--------------------------!--------------------------! +! !! ! ! ! +! Windows service !! SeServiceLogonRight ! SeServiceLogonRight ! Windows XP/Server 2003 ! +! by !! ! SeCreateTokenPrivilege ! ! +! !! ! ! ! +!-------------------!!-----------------------!--------------------------!--------------------------! +! !! ! ! ! +! Windows service !! ! ! Windows XP ! +! by SYSTEM !! --- ! --- ! only ! +! !! ! ! ! +! !! ! ! ! + -------------------------------------------------------------------------------------------------- Warning!!! You have to understand that a installing of additional privileges can decrease your OS security level. Open the ports for sshd, pbs_server, pbs_mom and pbs_sched in your firewalls. -Reboot your computers. +Reboot your computers!!! @@ -171,12 +161,6 @@ #echo "ls -l" | qsub #qstat -Run Windows application: - - #echo "/cygdrive/c/WINDOWS/system32/mspaint.exe" | qsub - #qstat - #qdel all - ######################################################## @@ -185,7 +169,7 @@ Enter into working directory as and execute the following commands: - #./configure --disable-daemons --disable-unixsockets + #./configure --disable-daemons --disable-unixsockets --disable-gcc-warnings #make #make install @@ -197,17 +181,17 @@ For example: - #./contrib/AddPrivileges + #./contrib/AddPrivileges --add #cygrunsrv.exe -I pbs_server -p /usr/sbin/pbs_server.exe –u -w #cygrunsrv.exe -I pbs_sched -p /usr/sbin/pbs_sched.exe –u -w - #./contrib/AddPrivileges mom + #./contrib/AddPrivileges --add mom #cygrunsrv.exe -I pbs_mom -p /usr/sbin/pbs_mom.exe –u -w On Windows XP also can start server-sched-mom as services by Windows native user SYSTEM (uid=18): - #./contrib/AddPrivileges SYSTEM + #./contrib/AddPrivileges --add SYSTEM #chown SYSTEM -R /var/spool/torque #cygrunsrv.exe -I pbs_mom -p /usr/sbin/pbs_mom.exe diff -Naur ./torque-trunk-3545-cygwin/src/include/pbs_config.h.in ./new-trunk-3545/src/include/pbs_config.h.in --- ./torque-trunk-3545-cygwin/src/include/pbs_config.h.in 2009-11-03 23:10:29.028425000 +0200 +++ ./new-trunk-3545/src/include/pbs_config.h.in 2010-03-31 19:56:17.692116548 +0300 @@ -551,21 +551,18 @@ #endif - #ifndef __GNUC__ # define __attribute__ /* nothing */ #endif + +/* Needs for the old Cygwin versions (gcc 3.3 or earlier) */ +/* #ifdef __CYGWIN__ -/* sys/types.h from cygwin fails to define uid_t and gid_t */ -#ifndef uid_t #define uid_t int -#endif -#ifndef gid_t #define gid_t int -#endif -#endif /* __CYGWIN__ */ - +#endif +*/ #endif /* _PBS_CONFIG_H_ */ diff -Naur ./torque-trunk-3545-cygwin/src/lib/Liblog/chk_file_sec.c ./new-trunk-3545/src/lib/Liblog/chk_file_sec.c --- ./torque-trunk-3545-cygwin/src/lib/Liblog/chk_file_sec.c 2009-12-15 03:00:51.193994000 +0200 +++ ./new-trunk-3545/src/lib/Liblog/chk_file_sec.c 2010-03-31 19:52:58.614116192 +0300 @@ -179,10 +179,6 @@ if ((p = getpwuid(getuid())) && (gr = getgrgid(544)) != NULL) { - if (getuid() < 1000) - { - return 0; - } for (t = gr->gr_mem; t && *t; t++) { if (!strcmp (p->pw_name, *t)) @@ -208,10 +204,6 @@ if ((gr = getgrgid(544)) != NULL) { - if (getuid() < 1000) - { - return 0; - } for (t = gr->gr_mem; t && *t; t++) if (!strcmp (userName, *t)) { diff -Naur ./torque-trunk-3545-cygwin/src/lib/Libnet/net_client.c ./new-trunk-3545/src/lib/Libnet/net_client.c --- ./torque-trunk-3545-cygwin/src/lib/Libnet/net_client.c 2009-12-15 03:00:51.193994000 +0200 +++ ./new-trunk-3545/src/lib/Libnet/net_client.c 2010-03-23 14:22:10.000000000 +0200 @@ -481,7 +481,7 @@ close(sock); - return(PBS_NET_RC_FATAL); + return(PBS_NET_RC_RETRY); /*NOTREACHED*/ @@ -542,7 +542,7 @@ close(sock); - return(PBS_NET_RC_RETRY); + return(PBS_NET_RC_FATAL); } /* END switch (errno) */ diff -Naur ./torque-trunk-3545-cygwin/src/server/svr_chk_owner.c ./new-trunk-3545/src/server/svr_chk_owner.c --- ./torque-trunk-3545-cygwin/src/server/svr_chk_owner.c 2010-01-11 23:10:16.373971000 +0200 +++ ./new-trunk-3545/src/server/svr_chk_owner.c 2010-03-23 14:16:49.000000000 +0200 @@ -329,6 +329,14 @@ /* NOTE: enable case insensitive host check (CRI) */ +#ifdef __CYGWIN__ + if (IamAdminByName(user) && !strcasecmp(host_no_port, server_host)) + { + is_root = 1; + return(priv | ATR_DFLAG_MGRD | ATR_DFLAG_MGWR | ATR_DFLAG_OPRD | ATR_DFLAG_OPWR); + } +#else /* __CYGWIN__ */ + if ((strcmp(user, PBS_DEFAULT_ADMIN) == 0) && !strcasecmp(host_no_port, server_host)) { @@ -338,6 +346,7 @@ return(priv | ATR_DFLAG_MGRD | ATR_DFLAG_MGWR | ATR_DFLAG_OPRD | ATR_DFLAG_OPWR); #endif } +#endif /* __CYGWIN__ */ if (!(server.sv_attr[(int)SRV_ATR_managers].at_flags & ATR_VFLAG_SET)) {