+static inline uint32_t
+str_to_cid(const char *str)
+{
+ long lcid = strtol(str, NULL, 16);
+
+ if(lcid > UINT32_MAX || lcid <= 0)
+ {
+ iwarn("authd sent us back a bad client ID: %lx", lcid);
+ restart_authd();
+ return 0;
+ }
+
+ return (uint32_t)lcid;
+}
+
+static inline struct Client *
+cid_to_client(uint32_t cid, bool delete)
+{
+ struct Client *client_p;
+
+ if(delete)
+ client_p = rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(cid));
+ else
+ client_p = rb_dictionary_retrieve(cid_clients, RB_UINT_TO_POINTER(cid));
+
+ if(client_p == NULL)
+ {
+ iwarn("authd sent us back a bad client ID: %ux", cid);
+ restart_authd();
+ return NULL;
+ }
+
+ return client_p;
+}
+