diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-01-07 10:56:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:49:50 -0500 |
commit | da8151ae9f42b86868fa2ad3fc3825f2285a2fb4 (patch) | |
tree | edc4eb602fdb84a1a3e0c1252c7160910929b1af /source4/nbt_server/wins | |
parent | ddf0e3d046c668a7cc7133bed45939187f3bd138 (diff) | |
download | samba-da8151ae9f42b86868fa2ad3fc3825f2285a2fb4.tar.gz samba-da8151ae9f42b86868fa2ad3fc3825f2285a2fb4.tar.bz2 samba-da8151ae9f42b86868fa2ad3fc3825f2285a2fb4.zip |
r12755: check the return value of ldb_timestring(), as this fails,
when gmtime() fails...
metze
(This used to be commit 523746f2712371041800301294c73bb7686bf2d5)
Diffstat (limited to 'source4/nbt_server/wins')
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index e64ebdd60a..72dbd77959 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -318,10 +318,14 @@ static int ldb_msg_add_winsdb_addr(struct ldb_message *msg, { struct ldb_val val; const char *str; + char *expire_time; + expire_time = ldb_timestring(msg, addr->expire_time); + if (!expire_time) return -1; str = talloc_asprintf(msg, "%s;winsOwner:%s;expireTime:%s;", addr->address, addr->wins_owner, - ldb_timestring(msg, addr->expire_time)); + expire_time); + talloc_free(expire_time); if (!str) return -1; val.data = discard_const_p(uint8_t, str); @@ -588,8 +592,9 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb, { int i, ret=0; size_t addr_count; + const char *expire_time; struct ldb_message *msg = ldb_msg_new(mem_ctx); - if (msg == NULL) goto failed; + if (msg == NULL) goto failed; if (rec->is_static) { rec->state = WREPL_STATE_ACTIVE; @@ -608,6 +613,11 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb, rec->type = WREPL_TYPE_MHOMED; } + expire_time = ldb_timestring(msg, rec->expire_time); + if (!expire_time) { + goto failed; + } + msg->dn = winsdb_dn(msg, rec->name); if (msg->dn == NULL) goto failed; ret |= ldb_msg_add_fmt(msg, "type", "0x%02X", rec->name->type); @@ -622,8 +632,7 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb, ret |= ldb_msg_add_fmt(msg, "recordState", "%u", rec->state); ret |= ldb_msg_add_fmt(msg, "nodeType", "%u", rec->node); ret |= ldb_msg_add_fmt(msg, "isStatic", "%u", rec->is_static); - ret |= ldb_msg_add_string(msg, "expireTime", - ldb_timestring(msg, rec->expire_time)); + ret |= ldb_msg_add_string(msg, "expireTime", expire_time); ret |= ldb_msg_add_fmt(msg, "versionID", "%llu", (long long)rec->version); ret |= ldb_msg_add_string(msg, "winsOwner", rec->wins_owner); ret |= ldb_msg_add_empty(msg, "address", 0); |