MCPcopy Create free account
hub / github.com/apache/httpd / gen_nonce

Function gen_nonce

modules/aaa/mod_auth_digest.c:1110–1134  ·  view source on GitHub ↗

The nonce has the format b64(time)+hash . */

Source from the content-addressed store, hash-verified

1108/* The nonce has the format b64(time)+hash .
1109 */
1110static const char *gen_nonce(apr_pool_t *p, apr_time_t now, const char *opaque,
1111 const server_rec *server,
1112 const digest_config_rec *conf)
1113{
1114 char *nonce = apr_palloc(p, NONCE_LEN+1);
1115 time_rec t;
1116
1117 if (conf->nonce_lifetime != 0) {
1118 t.time = now;
1119 }
1120 else if (otn_counter) {
1121 /* this counter is not synch'd, because it doesn't really matter
1122 * if it counts exactly.
1123 */
1124 t.time = (*otn_counter)++;
1125 }
1126 else {
1127 /* XXX: WHAT IS THIS CONSTANT? */
1128 t.time = 42;
1129 }
1130 apr_base64_encode_binary(nonce, t.arr, sizeof(t.arr));
1131 gen_nonce_hash(nonce+NONCE_TIME_LEN, nonce, opaque, server, conf);
1132
1133 return nonce;
1134}
1135
1136
1137/*

Callers 2

note_digest_auth_failureFunction · 0.85
add_auth_infoFunction · 0.85

Calls 1

gen_nonce_hashFunction · 0.85

Tested by

no test coverage detected