MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsSetServerCredentials

Function cupsSetServerCredentials

cups/tls-openssl.c:272–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270 */
271
272int // O - 1 on success, 0 on failure
273cupsSetServerCredentials(
274 const char *path, // I - Path to keychain/directory
275 const char *common_name, // I - Default common name for server
276 int auto_create) // I - 1 = automatically create self-signed certificates
277{
278 char temp[1024]; // Default path buffer
279
280
281 DEBUG_printf(("cupsSetServerCredentials(path=\"%s\", common_name=\"%s\", auto_create=%d)", path, common_name, auto_create));
282
283 /*
284 * Use defaults as needed...
285 */
286
287 if (!path)
288 path = http_default_path(temp, sizeof(temp));
289
290 /*
291 * Range check input...
292 */
293
294 if (!path || !common_name)
295 {
296 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
297 return (0);
298 }
299
300 _cupsMutexLock(&tls_mutex);
301
302 /*
303 * Free old values...
304 */
305
306 if (tls_keypath)
307 _cupsStrFree(tls_keypath);
308
309 if (tls_common_name)
310 _cupsStrFree(tls_common_name);
311
312 /*
313 * Save the new values...
314 */
315
316 tls_keypath = _cupsStrAlloc(path);
317 tls_auto_create = auto_create;
318 tls_common_name = _cupsStrAlloc(common_name);
319
320 _cupsMutexUnlock(&tls_mutex);
321
322 return (1);
323}
324
325
326/*

Callers

nothing calls this directly

Calls 6

http_default_pathFunction · 0.85
_cupsSetErrorFunction · 0.85
_cupsMutexLockFunction · 0.85
_cupsStrFreeFunction · 0.85
_cupsStrAllocFunction · 0.85
_cupsMutexUnlockFunction · 0.85

Tested by

no test coverage detected