Re: Date expansion fails for inner encryption tunnel log files.



Arran Cudbard-Bell wrote:
> Yes dual core Power PC G5 64bit CPU.

  That's what I thought.

  Posix says that "struct timeval" has member "time_t tv_sec".  So it
*should* be safe to pass a pointer to tv_sec to a function that takes a
"time_t *", right?

  Apparently not on the Mac. <sigh>  Please try the attached patch.

  Alan DeKok.
--
  http://deployingradius.com       - The web site of the book
  http://deployingradius.com/blog/ - The blog
Index: src/main/event.c
===================================================================
RCS file: /source/radiusd/src/main/event.c,v
retrieving revision 1.33
diff -u -r1.33 event.c
--- src/main/event.c	24 Apr 2007 09:18:58 -0000	1.33
+++ src/main/event.c	9 May 2007 09:35:41 -0000
@@ -685,6 +685,8 @@
 					PW_POST_PROXY_TYPE, PW_TYPE_INTEGER);
 	vp->vp_integer = dval->value;
 
+	rad_assert(request->proxy_reply = NULL);
+
 	return 1;
 }
 
@@ -1729,6 +1731,7 @@
 	request->next_callback = NULL;
 
 	gettimeofday(&request->received, NULL);
+	request->timestamp = request->received.tv_sec;
 	request->when = request->received;
 	request->delay = USEC / 10;
 
Index: src/main/xlat.c
===================================================================
RCS file: /source/radiusd/src/main/xlat.c,v
retrieving revision 1.119
diff -u -r1.119 xlat.c
--- src/main/xlat.c	23 Apr 2007 08:10:28 -0000	1.119
+++ src/main/xlat.c	9 May 2007 09:35:41 -0000
@@ -375,6 +375,7 @@
 }
 #endif				/* HAVE_REGEX_H */
 
+
 /*
  *	Compare two xlat_t structs, based ONLY on the module name.
  */
@@ -917,7 +918,7 @@
 				p++;
 				break;
 			case 'd': /* request day */
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%d", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);
@@ -941,7 +942,7 @@
 				p++;
 				break;
 			case 'm': /* request month */
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%m", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);
@@ -962,7 +963,7 @@
 				p++;
 				break;
 			case 't': /* request timestamp */
-				CTIME_R(&request->received.tv_sec, tmpdt, sizeof(tmpdt));
+				CTIME_R(&request->timestamp, tmpdt, sizeof(tmpdt));
 				nl = strchr(tmpdt, '\n');
 				if (nl) *nl = '\0';
 				strlcpy(q, tmpdt, freespace);
@@ -984,7 +985,7 @@
 				p++;
 				break;
 			case 'D': /* request date */
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%Y%m%d", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);
@@ -993,7 +994,7 @@
 				p++;
 				break;
 			case 'H': /* request hour */
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%H", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);
@@ -1016,7 +1017,7 @@
 				p++;
 				break;
 			case 'S': /* request timestamp in SQL format*/
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%Y-%m-%d %H:%M:%S", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);
@@ -1025,7 +1026,7 @@
 				p++;
 				break;
 			case 'T': /* request timestamp */
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%Y-%m-%d-%H.%M.%S.000000", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);
@@ -1043,7 +1044,7 @@
 				p++;
 				break;
 			case 'Y': /* request year */
-				TM = localtime_r(&request->received.tv_sec, &s_TM);
+				TM = localtime_r(&request->timestamp, &s_TM);
 				len = strftime(tmpdt, sizeof(tmpdt), "%Y", TM);
 				if (len > 0) {
 					strlcpy(q, tmpdt, freespace);


This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.