Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
Don't attempt to cache NULL clientid, username or topic
Browse files Browse the repository at this point in the history
	fixes #43
  • Loading branch information
jpmens committed Nov 23, 2014
1 parent e4f1f81 commit d6d7f51
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ void acl_cache(const char *clientid, const char *username, const char *topic, in
return;
}

if (!clientid || !username || !topic) {
return;
}

now = time(NULL);

hexify(clientid, username, topic, access, hex);
Expand Down Expand Up @@ -141,6 +145,11 @@ int cache_q(const char *clientid, const char *username, const char *topic, int a
if (ud->cacheseconds <= 0) {
return (MOSQ_ERR_UNKNOWN);
}

if (!clientid || !username || !topic) {
return (MOSQ_ERR_UNKNOWN);
}

hexify(clientid, username, topic, access, hex);

HASH_FIND_STR(ud->aclcache, hex, a);
Expand Down

0 comments on commit d6d7f51

Please sign in to comment.