projects
/
srvx.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix possible crash on user deletion
[srvx.git]
/
src
/
gline.c
diff --git
a/src/gline.c
b/src/gline.c
index a1cb2504ea81e790e2e5c509dc54ab38d349207c..bb169ab1cadca42875d0f6c5ddf54186c0832cb0 100644
(file)
--- a/
src/gline.c
+++ b/
src/gline.c
@@
-52,7
+52,7
@@
static int
gline_comparator(const void *a, const void *b)
{
const struct gline *ga=a, *gb=b;
gline_comparator(const void *a, const void *b)
{
const struct gline *ga=a, *gb=b;
- return ga->
expires - gb->expires
;
+ return ga->
lifetime - gb->lifetime
;
}
static void
}
static void
@@
-127,20
+127,16
@@
gline_add(const char *issuer, const char *target, unsigned long duration, const
heap_remove_pred(gline_heap, gline_equal_p, ent);
if (ent->issued > lastmod)
ent->issued = lastmod;
heap_remove_pred(gline_heap, gline_equal_p, ent);
if (ent->issued > lastmod)
ent->issued = lastmod;
- if (ent->lastmod < lastmod)
+ if (ent->lastmod < lastmod)
{
ent->lastmod = lastmod;
ent->lastmod = lastmod;
- if (ent->expires != expires)
- ent->expires = expires;
+ ent->expires = expires;
+ if (strcmp(ent->reason, reason)) {
+ free(ent->reason);
+ ent->reason = strdup(reason);
+ }
+ }
if (ent->lifetime < lifetime)
ent->lifetime = lifetime;
if (ent->lifetime < lifetime)
ent->lifetime = lifetime;
- if (strcmp(ent->issuer, issuer)) {
- free(ent->issuer);
- ent->issuer = strdup(issuer);
- }
- if (strcmp(ent->reason, reason)) {
- free(ent->reason);
- ent->reason = strdup(reason);
- }
} else {
ent = malloc(sizeof(*ent));
ent->issued = issued;
} else {
ent = malloc(sizeof(*ent));
ent->issued = issued;