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

Function http_default_path

cups/tls-openssl.c:1461–1504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1459 */
1460
1461static const char * // O - Path or NULL on error
1462http_default_path(
1463 char *buffer, // I - Path buffer
1464 size_t bufsize) // I - Size of path buffer
1465{
1466 _cups_globals_t *cg = _cupsGlobals();
1467 // Pointer to library globals
1468
1469
1470#ifdef _WIN32
1471 if (cg->home)
1472#else
1473 if (cg->home && getuid())
1474#endif // _WIN32
1475 {
1476 snprintf(buffer, bufsize, "%s/.cups", cg->home);
1477 if (access(buffer, 0))
1478 {
1479 DEBUG_printf(("1http_default_path: Making directory \"%s\".", buffer));
1480 if (mkdir(buffer, 0700))
1481 {
1482 DEBUG_printf(("1http_default_path: Failed to make directory: %s", strerror(errno)));
1483 return (NULL);
1484 }
1485 }
1486
1487 snprintf(buffer, bufsize, "%s/.cups/ssl", cg->home);
1488 if (access(buffer, 0))
1489 {
1490 DEBUG_printf(("1http_default_path: Making directory \"%s\".", buffer));
1491 if (mkdir(buffer, 0700))
1492 {
1493 DEBUG_printf(("1http_default_path: Failed to make directory: %s", strerror(errno)));
1494 return (NULL);
1495 }
1496 }
1497 }
1498 else
1499 strlcpy(buffer, CUPS_SERVERROOT "/ssl", bufsize);
1500
1501 DEBUG_printf(("1http_default_path: Using default path \"%s\".", buffer));
1502
1503 return (buffer);
1504}
1505
1506
1507//

Callers 4

cupsSetServerCredentialsFunction · 0.85
httpLoadCredentialsFunction · 0.85
httpSaveCredentialsFunction · 0.85

Calls 1

_cupsGlobalsFunction · 0.85

Tested by

no test coverage detected