fixed some Y2038 issues related to 64bit time support for 32bit plattforms
This commit is contained in:
parent
7c94d30212
commit
91e041dbfc
@ -1,5 +1,7 @@
|
|||||||
0.8.4dev
|
0.8.4dev
|
||||||
========
|
========
|
||||||
|
25-Oct-2021: - fixed some Y2038 issues related to 64bit time
|
||||||
|
support for 32bit plattforms
|
||||||
29-Jun-2021: - fix: silence_log handling - was always logging
|
29-Jun-2021: - fix: silence_log handling - was always logging
|
||||||
everything to syslog,even if set to >0
|
everything to syslog,even if set to >0
|
||||||
27-Dec-2020: - plugin_stripheaders: deal with mode header field
|
27-Dec-2020: - plugin_stripheaders: deal with mode header field
|
||||||
|
|||||||
@ -74,7 +74,7 @@ void register_init(void) {
|
|||||||
for (i=0;i < URLMAP_SIZE; i++) {
|
for (i=0;i < URLMAP_SIZE; i++) {
|
||||||
t=fgets(buff, sizeof(buff), stream);
|
t=fgets(buff, sizeof(buff), stream);
|
||||||
if (t==NULL) { break;}
|
if (t==NULL) { break;}
|
||||||
sts=sscanf(buff, "****:%i:%i", &urlmap[i].active, &urlmap[i].expires);
|
sts=sscanf(buff, "****:%i:%"TIME_T_INT_FMT , &urlmap[i].active, &urlmap[i].expires);
|
||||||
if (sts == 0) break; /* format error */
|
if (sts == 0) break; /* format error */
|
||||||
if (urlmap[i].active) {
|
if (urlmap[i].active) {
|
||||||
#define R(X) {\
|
#define R(X) {\
|
||||||
@ -146,7 +146,7 @@ void register_save(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i < URLMAP_SIZE; i++) {
|
for (i=0;i < URLMAP_SIZE; i++) {
|
||||||
fprintf(stream, "****:%i:%i\n", urlmap[i].active, urlmap[i].expires);
|
fprintf(stream, "****:%i:%"TIME_T_INT_FMT "\n", urlmap[i].active, urlmap[i].expires);
|
||||||
if (urlmap[i].active) {
|
if (urlmap[i].active) {
|
||||||
#define W(X) { \
|
#define W(X) { \
|
||||||
char *tmp=NULL; \
|
char *tmp=NULL; \
|
||||||
@ -336,12 +336,12 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
|
|||||||
/* check address-of-record ("public address" of user) */
|
/* check address-of-record ("public address" of user) */
|
||||||
if (compare_url(url1_to, url2_to)==STS_SUCCESS) {
|
if (compare_url(url1_to, url2_to)==STS_SUCCESS) {
|
||||||
DEBUGC(DBCLASS_REG, "found entry for %s@%s <-> %s@%s at "
|
DEBUGC(DBCLASS_REG, "found entry for %s@%s <-> %s@%s at "
|
||||||
"slot=%i, exp=%li",
|
"slot=%i, exp=%"TIME_T_INT_FMT,
|
||||||
(url1_contact->username) ? url1_contact->username : "*NULL*",
|
(url1_contact->username) ? url1_contact->username : "*NULL*",
|
||||||
(url1_contact->host) ? url1_contact->host : "*NULL*",
|
(url1_contact->host) ? url1_contact->host : "*NULL*",
|
||||||
(url2_to->username) ? url2_to->username : "*NULL*",
|
(url2_to->username) ? url2_to->username : "*NULL*",
|
||||||
(url2_to->host) ? url2_to->host : "*NULL*",
|
(url2_to->host) ? url2_to->host : "*NULL*",
|
||||||
i, (long)urlmap[i].expires-time_now);
|
i, urlmap[i].expires-time_now);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
struct urlmap_s {
|
struct urlmap_s {
|
||||||
int active;
|
int active;
|
||||||
int expires;
|
time_t expires;
|
||||||
osip_uri_t *true_url; // true URL of UA (inbound URL)
|
osip_uri_t *true_url; // true URL of UA (inbound URL)
|
||||||
osip_uri_t *masq_url; // masqueraded URL (outbound URL)
|
osip_uri_t *masq_url; // masqueraded URL (outbound URL)
|
||||||
osip_uri_t *reg_url; // registered URL (masq URL as wished by UA)
|
osip_uri_t *reg_url; // registered URL (masq URL as wished by UA)
|
||||||
@ -352,6 +352,22 @@ int unload_plugins(void);
|
|||||||
#define satoi atoi /* used in libosips MSG_TEST_CODE macro ... */
|
#define satoi atoi /* used in libosips MSG_TEST_CODE macro ... */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Y2038 stuff (64bit time_t in 32bit C libs)
|
||||||
|
* reason:
|
||||||
|
* libc64: long int ("ld") -> 64bit
|
||||||
|
* libc32: long int ("ld") -> 32bit
|
||||||
|
* also see: https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
|
||||||
|
*
|
||||||
|
* TIME_T_INT_FMT: time_t format string to use in printf/scanf
|
||||||
|
*/
|
||||||
|
#ifndef TIME_T_INT_FMT
|
||||||
|
#ifdef __USE_TIME_BITS64
|
||||||
|
#define TIME_T_INT_FMT PRId64
|
||||||
|
#else
|
||||||
|
#define TIME_T_INT_FMT "ld"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macro that limits the frequency of this particular code
|
* Macro that limits the frequency of this particular code
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user