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  * These coded instructions, statements, and computer programs are the
11  * property of Apple Inc. and are protected by Federal copyright
12  * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
13  * which should have been included with this file.  If this file is
14  * missing or damaged, see the license at "http://www.cups.org/".
15  *
16  * This file is subject to the Apple OS-Developed Software exception.
17  */
18 
19 /*
20  * Include necessary headers...
21  */
22 
23 #include "cups-private.h"
24 #include <fcntl.h>
25 #include <math.h>
26 #ifdef WIN32
27 #  include <tchar.h>
28 #else
29 #  include <signal.h>
30 #  include <sys/time.h>
31 #  include <sys/resource.h>
32 #endif /* WIN32 */
33 #ifdef HAVE_POLL
34 #  include <poll.h>
35 #endif /* HAVE_POLL */
36 
37 
38 /*
39  * Local functions...
40  */
41 
42 #ifdef HAVE_SSL
43 #  ifdef HAVE_GNUTLS
44 #    include "tls-gnutls.c"
45 #  elif defined(HAVE_CDSASSL)
46 #    include "tls-darwin.c"
47 #  elif defined(HAVE_SSPISSL)
48 #    include "tls-sspi.c"
49 #  endif /* HAVE_GNUTLS */
50 #else
51 /* Stubs for when TLS is not supported/available */
52 int
httpCopyCredentials(http_t * http,cups_array_t ** credentials)53 httpCopyCredentials(http_t *http, cups_array_t **credentials)
54 {
55   (void)http;
56   if (credentials)
57     *credentials = NULL;
58   return (-1);
59 }
60 int
httpCredentialsAreValidForName(cups_array_t * credentials,const char * common_name)61 httpCredentialsAreValidForName(cups_array_t *credentials, const char *common_name)
62 {
63   (void)credentials;
64   (void)common_name;
65   return (1);
66 }
67 time_t
httpCredentialsGetExpiration(cups_array_t * credentials)68 httpCredentialsGetExpiration(cups_array_t *credentials)
69 {
70   (void)credentials;
71   return (INT_MAX);
72 }
73 http_trust_t
httpCredentialsGetTrust(cups_array_t * credentials,const char * common_name)74 httpCredentialsGetTrust(cups_array_t *credentials, const char *common_name)
75 {
76   (void)credentials;
77   (void)common_name;
78   return (HTTP_TRUST_OK);
79 }
80 size_t
httpCredentialsString(cups_array_t * credentials,char * buffer,size_t bufsize)81 httpCredentialsString(cups_array_t *credentials, char *buffer, size_t bufsize)
82 {
83   (void)credentials;
84   (void)bufsize;
85   if (buffer)
86     *buffer = '\0';
87   return (0);
88 }
89 int
httpLoadCredentials(const char * path,cups_array_t ** credentials,const char * common_name)90 httpLoadCredentials(const char *path, cups_array_t **credentials, const char *common_name)
91 {
92   (void)path;
93   (void)credentials;
94   (void)common_name;
95   return (-1);
96 }
97 int
httpSaveCredentials(const char * path,cups_array_t * credentials,const char * common_name)98 httpSaveCredentials(const char *path, cups_array_t *credentials, const char *common_name)
99 {
100   (void)path;
101   (void)credentials;
102   (void)common_name;
103   return (-1);
104 }
105 #endif /* HAVE_SSL */
106