]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/tls.c
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / cups / tls.c
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 <fcntl.h>
19 #include <math.h>
20 #ifdef WIN32
21 # include <tchar.h>
22 #else
23 # include <signal.h>
24 # include <sys/time.h>
25 # include <sys/resource.h>
26 #endif /* WIN32 */
27 #ifdef HAVE_POLL
28 # include <poll.h>
29 #endif /* HAVE_POLL */
30
31
32 /*
33 * Local functions...
34 */
35
36 #ifdef HAVE_SSL
37 # ifdef HAVE_GNUTLS
38 # include "tls-gnutls.c"
39 # elif defined(HAVE_CDSASSL)
40 # include "tls-darwin.c"
41 # elif defined(HAVE_SSPISSL)
42 # include "tls-sspi.c"
43 # endif /* HAVE_GNUTLS */
44 #else
45 /* Stubs for when TLS is not supported/available */
46 int
47 httpCopyCredentials(http_t *http, cups_array_t **credentials)
48 {
49 (void)http;
50 if (credentials)
51 *credentials = NULL;
52 return (-1);
53 }
54 int
55 httpCredentialsAreValidForName(cups_array_t *credentials, const char *common_name)
56 {
57 (void)credentials;
58 (void)common_name;
59 return (1);
60 }
61 time_t
62 httpCredentialsGetExpiration(cups_array_t *credentials)
63 {
64 (void)credentials;
65 return (INT_MAX);
66 }
67 http_trust_t
68 httpCredentialsGetTrust(cups_array_t *credentials, const char *common_name)
69 {
70 (void)credentials;
71 (void)common_name;
72 return (HTTP_TRUST_OK);
73 }
74 size_t
75 httpCredentialsString(cups_array_t *credentials, char *buffer, size_t bufsize)
76 {
77 (void)credentials;
78 (void)bufsize;
79 if (buffer)
80 *buffer = '\0';
81 return (0);
82 }
83 int
84 httpLoadCredentials(const char *path, cups_array_t **credentials, const char *common_name)
85 {
86 (void)path;
87 (void)credentials;
88 (void)common_name;
89 return (-1);
90 }
91 int
92 httpSaveCredentials(const char *path, cups_array_t *credentials, const char *common_name)
93 {
94 (void)path;
95 (void)credentials;
96 (void)common_name;
97 return (-1);
98 }
99 #endif /* HAVE_SSL */