Index by UID
[citadel.git] / citadel / user_ops.c
index bfd2660b65d69c0f2946a459c0a3f51015f0986f..7e82d3188184a900b491414c1fb59dca31dd1712 100644 (file)
@@ -1027,6 +1027,14 @@ int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid)
        CtdlPutUser(usbuf);
        cdb_store(CDB_USERSBYNUMBER, &usbuf->usernum, sizeof(long), usbuf->fullname, strlen(usbuf->fullname)+1);
 
+       /* If non-native auth, index by uid */
+       if (usbuf->uid > 0) {
+               StrBuf *claimed_id = NewStrBuf();
+               StrBufPrintf(claimed_id, "uid:%d", usbuf->uid);
+               attach_extauth(usbuf, claimed_id);
+               FreeStrBuf(&claimed_id);
+       }
+
        return 0;
 }