xref: /aosp_15_r20/external/libcups/cups/tls.c (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1 /*
2  * TLS routines for CUPS.
3  *
4  * Copyright 2007-2014 by Apple Inc.
5  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
6  *
7  * This file contains Kerberos support code, copyright 2006 by
8  * Jelmer Vernooij.
9  *
10  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
11  */
12 
13 /*
14  * Include necessary headers...
15  */
16 
17 #include "cups-private.h"
18 #include "debug-internal.h"
19 #include <fcntl.h>
20 #include <math.h>
21 #ifdef _WIN32
22 #  include <tchar.h>
23 #else
24 #  include <signal.h>
25 #  include <sys/time.h>
26 #  include <sys/resource.h>
27 #endif /* _WIN32 */
28 #ifdef HAVE_POLL
29 #  include <poll.h>
30 #endif /* HAVE_POLL */
31 
32 
33 /*
34  * Include platform-specific TLS code...
35  */
36 
37 #ifdef HAVE_SSL
38 #  ifdef HAVE_GNUTLS
39 #    include "tls-gnutls.c"
40 #  elif defined(HAVE_CDSASSL)
41 #    include "tls-darwin.c"
42 #  elif defined(HAVE_SSPISSL)
43 #    include "tls-sspi.c"
44 #  endif /* HAVE_GNUTLS */
45 #else
46 /* Stubs for when TLS is not supported/available */
47 int
httpCopyCredentials(http_t * http,cups_array_t ** credentials)48 httpCopyCredentials(http_t *http, cups_array_t **credentials)
49 {
50   (void)http;
51   if (credentials)
52     *credentials = NULL;
53   return (-1);
54 }
55 int
httpCredentialsAreValidForName(cups_array_t * credentials,const char * common_name)56 httpCredentialsAreValidForName(cups_array_t *credentials, const char *common_name)
57 {
58   (void)credentials;
59   (void)common_name;
60   return (1);
61 }
62 time_t
httpCredentialsGetExpiration(cups_array_t * credentials)63 httpCredentialsGetExpiration(cups_array_t *credentials)
64 {
65   (void)credentials;
66   return (INT_MAX);
67 }
68 http_trust_t
httpCredentialsGetTrust(cups_array_t * credentials,const char * common_name)69 httpCredentialsGetTrust(cups_array_t *credentials, const char *common_name)
70 {
71   (void)credentials;
72   (void)common_name;
73   return (HTTP_TRUST_OK);
74 }
75 size_t
httpCredentialsString(cups_array_t * credentials,char * buffer,size_t bufsize)76 httpCredentialsString(cups_array_t *credentials, char *buffer, size_t bufsize)
77 {
78   (void)credentials;
79   (void)bufsize;
80   if (buffer)
81     *buffer = '\0';
82   return (0);
83 }
84 int
httpLoadCredentials(const char * path,cups_array_t ** credentials,const char * common_name)85 httpLoadCredentials(const char *path, cups_array_t **credentials, const char *common_name)
86 {
87   (void)path;
88   (void)credentials;
89   (void)common_name;
90   return (-1);
91 }
92 int
httpSaveCredentials(const char * path,cups_array_t * credentials,const char * common_name)93 httpSaveCredentials(const char *path, cups_array_t *credentials, const char *common_name)
94 {
95   (void)path;
96   (void)credentials;
97   (void)common_name;
98   return (-1);
99 }
100 #endif /* HAVE_SSL */
101