Index: trunk/changelog
===================================================================
--- trunk/changelog	(revision 60)
+++ trunk/changelog	(revision 61)
@@ -1,2 +1,9 @@
+torque (4.1.0-2) unstable; urgency=low
+
+  * Some pbs_server updates
+  * enabled SARA pam patch so it logs in auth.log
+
+ -- Bas van der Vlies <basv@sara.nl>  Wed, 11 Jul 2012 09:43:45 +0200
+
 torque (4.1.0-1) unstable; urgency=low
 
Index: trunk/init.d
===================================================================
--- trunk/init.d	(revision 60)
+++ trunk/init.d	(revision 61)
@@ -58,5 +58,5 @@
 
 start_trqauth() {
-        start-stop-daemon --start --quiet --exec $TORQUE_DIR/trqauthd -- $PBS_TRQAUTH_OPTS
+        start-stop-daemon --start --quiet --background --exec $TORQUE_DIR/trqauthd -- $PBS_TRQAUTH_OPTS
         echo " pbs trqauth"
 }
Index: trunk/patches/pam_pbssimpleauth_4_X.patch
===================================================================
--- trunk/patches/pam_pbssimpleauth_4_X.patch	(revision 61)
+++ trunk/patches/pam_pbssimpleauth_4_X.patch	(revision 61)
@@ -0,0 +1,139 @@
+Index: src/pam/pam_pbssimpleauth.c
+===================================================================
+--- src/pam/pam_pbssimpleauth.c	(revision 6504)
++++ src/pam/pam_pbssimpleauth.c	(working copy)
+@@ -36,6 +36,11 @@
+ #define PAM_SM_AUTH
+ #define PAM_SM_ACCOUNT
+ 
++/*
++ * HVB: add for pam_syslog
++*/
++#include <security/pam_ext.h>
++
+ #ifdef HAVE_SECURITY_PAM_APPL_H
+ #include <security/pam_appl.h>
+ #endif
+@@ -77,7 +82,6 @@
+   char jobdirpath[PATH_MAX+1];
+   int debug = 0;
+ 
+-  openlog(MODNAME, LOG_PID, LOG_USER);
+   strcpy(jobdirpath, PBS_SERVER_HOME "/mom_priv/jobs");
+ 
+   /* step through arguments */
+@@ -89,16 +93,15 @@
+     else if (!strcmp(*argv, "jobdir"))
+       strncpy(jobdirpath, *argv, PATH_MAX);
+     else
+-      syslog(LOG_ERR, "unknown option: %s", *argv);
++      pam_syslog(pamh, LOG_ERR, "unknown option: %s", *argv);
+     }
+ 
+-  if (debug) syslog(LOG_INFO, "opening %s", jobdirpath);
++  if (debug) pam_syslog(pamh, LOG_INFO, "opening %s", jobdirpath);
+ 
+   if ((jobdir = opendir(jobdirpath)) == NULL)
+     {
+-    if (debug) syslog(LOG_INFO, "failed to open jobs dir: %s", strerror(errno));
++    if (debug) pam_syslog(pamh, LOG_INFO, "failed to open jobs dir: %s", strerror(errno));
+ 
+-    closelog();
+ 
+     return PAM_IGNORE;
+     }
+@@ -109,7 +112,6 @@
+ #if defined(PAM_CONV_AGAIN) && defined(PAM_INCOMPLETE)
+   if (retval == PAM_CONV_AGAIN)
+     {
+-    closelog();
+     return PAM_INCOMPLETE;
+     }
+ 
+@@ -117,8 +119,7 @@
+ 
+   if ((retval != PAM_SUCCESS) || !username)
+     {
+-    syslog(LOG_ERR, "failed to retrieve username");
+-    closelog();
++    pam_syslog(pamh, LOG_ERR, "failed to retrieve username");
+     return PAM_SERVICE_ERR;
+     }
+ 
+@@ -126,7 +127,7 @@
+ 
+   /* no early returns from this point on because we need to free ubuf */
+ 
+-  if (debug) syslog(LOG_INFO, "username %s, %s", username, user_pwd ? "known" : "unknown");
++  if (debug) pam_syslog(pamh, LOG_INFO, "username %s, %s", username, user_pwd ? "known" : "unknown");
+ 
+   if (!user_pwd)
+     {
+@@ -134,7 +135,7 @@
+     }
+   else if (user_pwd->pw_uid == 0)
+     {
+-    if (debug) syslog(LOG_INFO, "allowing uid 0");
++    if (debug) pam_syslog(pamh, LOG_INFO, "allowing uid 0");
+ 
+     retval = PAM_SUCCESS;
+     }
+@@ -149,13 +150,13 @@
+ 
+       snprintf(jobpath, PATH_MAX - 1, "%s/%s", jobdirpath, jdent->d_name);
+ 
+-      if (debug) syslog(LOG_INFO, "opening %s", jobpath);
++      if (debug) pam_syslog(pamh, LOG_INFO, "opening %s", jobpath);
+ 
+       fp = open(jobpath, O_RDONLY, 0);
+ 
+       if (fp < 0)
+         {
+-        syslog(LOG_ERR, "error opening job file");
++        pam_syslog(pamh, LOG_ERR, "error opening job file");
+         continue;
+         }
+ 
+@@ -164,7 +165,7 @@
+       if (amt != sizeof(xjob.ji_qs))
+         {
+         close(fp);
+-        syslog(LOG_ERR, "short read of job file");
++        pam_syslog(pamh, LOG_ERR, "short read of job file");
+         continue;
+         }
+ 
+@@ -172,11 +173,11 @@
+         {
+         /* odd, this really should be JOB_UNION_TYPE_MOM */
+         close(fp);
+-        syslog(LOG_ERR, "job file corrupt");
++        pam_syslog(pamh, LOG_ERR, "job file corrupt");
+         continue;
+         }
+ 
+-      if (debug) syslog(LOG_INFO, "state=%d, substate=%d", xjob.ji_qs.ji_state, xjob.ji_qs.ji_substate);
++      if (debug) pam_syslog(pamh, LOG_INFO, "state=%d, substate=%d", xjob.ji_qs.ji_state, xjob.ji_qs.ji_substate);
+ 
+       if ((xjob.ji_qs.ji_un.ji_momt.ji_exuid == user_pwd->pw_uid) &&
+           ((xjob.ji_qs.ji_substate == JOB_SUBSTATE_PRERUN) ||
+@@ -186,7 +187,7 @@
+         /* success! */
+         close(fp);
+ 
+-        if (debug) syslog(LOG_INFO, "allowed by %s", jdent->d_name);
++        if (debug) pam_syslog(pamh, LOG_INFO, "allowed by %s", jdent->d_name);
+ 
+         retval = PAM_SUCCESS;
+ 
+@@ -203,9 +204,8 @@
+   if (ubuf)
+     free(ubuf);
+ 
+-  if (debug) syslog(LOG_INFO, "returning %s", retval == PAM_SUCCESS ? "success" : "failed");
++  if (debug) pam_syslog(pamh, LOG_INFO, "returning %s", retval == PAM_SUCCESS ? "success" : "failed");
+ 
+-  closelog();
+ 
+   return retval;
+   }
Index: trunk/patches/trqauth_syslog.patch
===================================================================
--- trunk/patches/trqauth_syslog.patch	(revision 61)
+++ trunk/patches/trqauth_syslog.patch	(revision 61)
@@ -0,0 +1,69 @@
+Index: trq_auth_daemon.c
+===================================================================
+--- trq_auth_daemon.c	(revision 6504)
++++ trq_auth_daemon.c	(working copy)
+@@ -36,8 +36,17 @@
+     /* Currently this only display's the port for the trq server
+      * from the lib_ifl.h file or server_name file (The same way
+      * the client utilities determine the pbs_server port)
+-     */
+-    printf("hostname: %s\n", tmp_name);
++    */
++    if (debug_mode == TRUE)
++      {
++      printf("pbs_server: %s\n", tmp_name);
++      }
++    else
++      {
++      openlog("trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
++      syslog(LOG_INFO, "pbs_server : %s\n", tmp_name);
++      closelog();
++      }
+     *ip = tmp_name;
+     PBS_get_server(tmp_name, (unsigned int *)t_port);
+     if (*t_port == 0)
+@@ -61,7 +70,18 @@
+     char **sign_key)
+   {
+   int rc = PBSE_NONE;
+-  fprintf(stderr, "pbs_server port is: %d\n", t_server_port);
++
++  if (debug_mode == TRUE)
++    {
++    fprintf(stderr, "pbs_server port is: %d\n", t_server_port);
++    }
++  else
++    {
++    openlog("trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
++    syslog(LOG_INFO, "pbs_server port is : %d\n", t_server_port);
++    closelog();
++    }
++
+   return rc;
+   }
+ 
+@@ -88,6 +108,7 @@
+ 
+   if (getenv("PBSDEBUG") != NULL)
+     debug_mode = TRUE;
++
+   if (debug_mode == FALSE)
+     {
+     pid = fork();
+@@ -104,11 +125,15 @@
+       }
+     else
+       {
+-      fprintf(stderr, "trqauthd daemonized - port %d\n", server_port);
++      openlog("trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
++      syslog(LOG_INFO, "daemonized - port: %d\n", server_port);
++      closelog();
++
+       /* If I made it here I am the child */
+       fclose(stdin);
+       fclose(stdout);
+       fclose(stderr);
++
+       /* We closed 0 (stdin), 1 (stdout), and 2 (stderr). fopen should give us
+          0, 1 and 2 in that order. this is a UNIX practice */
+       (void)fopen("/dev/null", "r");
Index: trunk/postinst
===================================================================
--- trunk/postinst	(revision 60)
+++ trunk/postinst	(revision 61)
@@ -171,17 +171,10 @@
 	if [ -x "`which invoke-rc.d 2>/dev/null`" ]
 	then
-        	if [ "$1" = configure ]
+        if [ "$1" = configure ]
 		then
-			invoke-rc.d torque restart || true
+			invoke-rc.d torque restart || exit $? 
 		else
-			invoke-rc.d torque start || exit 0
-        	fi
-	else
-        	if [ "$1" = configure ]
-		then
-			/etc/init.d/torque restart || true
-		else
-			/etc/init.d/torque start || exit 0
-		fi
+			invoke-rc.d torque start || exit $?
+        fi
 	fi
 fi
Index: trunk/rules
===================================================================
--- trunk/rules	(revision 60)
+++ trunk/rules	(revision 61)
@@ -79,5 +79,5 @@
 	dh_fixperms
 	dh_installdeb 
-	dh_makeshlibs
+	dh_makeshlibs --noscripts
 	dh_shlibdeps
 	dh_gencontrol 
