- ratelimit = (dbdata_ratelimit *)record;
- switch(fieldno)
- {
- case 0:
- if ((tt = read_time(value)) > 0) ratelimit->time_stamp = tt;
- else printf("bad time value\n");
- break;
-
- case 1:
- ratelimit->time_usec = Uatoi(value);
- break;
-
- case 2:
- ratelimit->rate = Ustrtod(value, NULL);
- break;
-
- case 3:
- if (Ustrstr(name, "/unique/") != NULL
- && oldlength >= sizeof(dbdata_ratelimit_unique))
- {
- rate_unique = (dbdata_ratelimit_unique *)record;
- if ((tt = read_time(value)) > 0) rate_unique->bloom_epoch = tt;
- else printf("bad time value\n");
- break;
- }
- /* else fall through */
-
- case 4:
- case 5:
- if (Ustrstr(name, "/unique/") != NULL
- && oldlength >= sizeof(dbdata_ratelimit_unique))
- {
- /* see acl.c */
- BOOL seen;
- unsigned n, hash, hinc;
- uschar md5sum[16];
- md5 md5info;
- md5_start(&md5info);
- md5_end(&md5info, value, Ustrlen(value), md5sum);
- hash = md5sum[0] << 0 | md5sum[1] << 8
- | md5sum[2] << 16 | md5sum[3] << 24;
- hinc = md5sum[4] << 0 | md5sum[5] << 8
- | md5sum[6] << 16 | md5sum[7] << 24;
- rate_unique = (dbdata_ratelimit_unique *)record;
- seen = TRUE;
- for (n = 0; n < 8; n++, hash += hinc)
- {
- int bit = 1 << (hash % 8);
- int byte = (hash / 8) % rate_unique->bloom_size;
- if ((rate_unique->bloom[byte] & bit) == 0)
- {
- seen = FALSE;
- if (fieldno == 5) rate_unique->bloom[byte] |= bit;
- }
- }
- printf("%s %s\n",
- seen ? "seen" : fieldno == 5 ? "added" : "unseen", value);
- break;
- }
- /* else fall through */
-
- default:
- printf("unknown field number\n");
- verify = 0;
- break;
- }
- break;
+ ratelimit = (dbdata_ratelimit *)record;
+ switch(fieldno)
+ {
+ case 0: if ((tt = read_time(value)) > 0) ratelimit->time_stamp = tt;
+ else printf("bad time value\n");
+ break;
+ case 1: ratelimit->time_usec = Uatoi(value);
+ break;
+ case 2: ratelimit->rate = Ustrtod(value, NULL);
+ break;
+ case 3: if (Ustrstr(name, "/unique/") != NULL
+ && oldlength >= sizeof(dbdata_ratelimit_unique))
+ {
+ rate_unique = (dbdata_ratelimit_unique *)record;
+ if ((tt = read_time(value)) > 0) rate_unique->bloom_epoch = tt;
+ else printf("bad time value\n");
+ break;
+ }
+ /* else fall through */
+ case 4:
+ case 5: if (Ustrstr(name, "/unique/") != NULL
+ && oldlength >= sizeof(dbdata_ratelimit_unique))
+ {
+ /* see acl.c */
+ BOOL seen;
+ unsigned hash, hinc;
+ uschar md5sum[16];
+ md5 md5info;
+ md5_start(&md5info);
+ md5_end(&md5info, value, Ustrlen(value), md5sum);
+ hash = md5sum[0] << 0 | md5sum[1] << 8
+ | md5sum[2] << 16 | md5sum[3] << 24;
+ hinc = md5sum[4] << 0 | md5sum[5] << 8
+ | md5sum[6] << 16 | md5sum[7] << 24;
+ rate_unique = (dbdata_ratelimit_unique *)record;
+ seen = TRUE;
+ for (unsigned n = 0; n < 8; n++, hash += hinc)
+ {
+ int bit = 1 << (hash % 8);
+ int byte = (hash / 8) % rate_unique->bloom_size;
+ if ((rate_unique->bloom[byte] & bit) == 0)
+ {
+ seen = FALSE;
+ if (fieldno == 5) rate_unique->bloom[byte] |= bit;
+ }
+ }
+ printf("%s %s\n",
+ seen ? "seen" : fieldno == 5 ? "added" : "unseen", value);
+ break;
+ }
+ /* else fall through */
+ default: printf("unknown field number\n");
+ verify = 0;
+ break;
+ }
+ break;