1 /*
2 * Configuration file for CUPS on Windows.
3 *
4 * Copyright © 2007-2019 by Apple Inc.
5 * Copyright © 1997-2007 by Easy Software Products.
6 *
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
8 * information.
9 */
10
11 #ifndef _CUPS_CONFIG_H_
12 #define _CUPS_CONFIG_H_
13
14 /*
15 * Include necessary headers...
16 */
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <stdarg.h>
22 #include <io.h>
23 #include <direct.h>
24
25
26 /*
27 * Microsoft renames the POSIX functions to _name, and introduces
28 * a broken compatibility layer using the original names. As a result,
29 * random crashes can occur when, for example, strdup() allocates memory
30 * from a different heap than used by malloc() and free().
31 *
32 * To avoid moronic problems like this, we #define the POSIX function
33 * names to the corresponding non-standard Microsoft names.
34 */
35
36 #define access _access
37 #define close _close
38 #define fileno _fileno
39 #define lseek _lseek
40 #define mkdir(d,p) _mkdir(d)
41 #define open _open
42 #define read _read
43 #define rmdir _rmdir
44 #define strdup _strdup
45 #define unlink _unlink
46 #define write _write
47
48
49 /*
50 * Microsoft "safe" functions use a different argument order than POSIX...
51 */
52
53 #define gmtime_r(t,tm) gmtime_s(tm,t)
54 #define localtime_r(t,tm) localtime_s(tm,t)
55
56
57 /*
58 * Map the POSIX strcasecmp() and strncasecmp() functions to the Win32
59 * _stricmp() and _strnicmp() functions...
60 */
61
62 #define strcasecmp _stricmp
63 #define strncasecmp _strnicmp
64
65
66 /*
67 * Map the POSIX sleep() and usleep() functions to the Win32 Sleep() function...
68 */
69
70 typedef unsigned long useconds_t;
71 #define sleep(X) Sleep(1000 * (X))
72 #define usleep(X) Sleep((X)/1000)
73
74
75 /*
76 * Map various parameters to Posix style system calls
77 */
78
79 # define F_OK 00
80 # define W_OK 02
81 # define R_OK 04
82 # define O_RDONLY _O_RDONLY
83 # define O_WRONLY _O_WRONLY
84 # define O_CREAT _O_CREAT
85 # define O_TRUNC _O_TRUNC
86
87
88 /*
89 * Compiler stuff...
90 */
91
92 #undef const
93 #undef __CHAR_UNSIGNED__
94
95
96 /*
97 * Version of software...
98 */
99
100 #define CUPS_SVERSION "CUPS v2.3.3"
101 #define CUPS_MINIMAL "CUPS/2.3.3"
102
103
104 /*
105 * Default user and groups...
106 */
107
108 #define CUPS_DEFAULT_USER ""
109 #define CUPS_DEFAULT_GROUP ""
110 #define CUPS_DEFAULT_SYSTEM_GROUPS ""
111 #define CUPS_DEFAULT_PRINTOPERATOR_AUTH ""
112 #define CUPS_DEFAULT_SYSTEM_AUTHKEY ""
113
114
115 /*
116 * Default file permissions...
117 */
118
119 #define CUPS_DEFAULT_CONFIG_FILE_PERM 0644
120 #define CUPS_DEFAULT_LOG_FILE_PERM 0644
121
122
123 /*
124 * Default logging settings...
125 */
126
127 #define CUPS_DEFAULT_LOG_LEVEL "warn"
128 #define CUPS_DEFAULT_ACCESS_LOG_LEVEL "none"
129
130
131 /*
132 * Default fatal error settings...
133 */
134
135 #define CUPS_DEFAULT_FATAL_ERRORS "config"
136
137
138 /*
139 * Default browsing settings...
140 */
141
142 #define CUPS_DEFAULT_BROWSING 1
143 #define CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS "dnssd"
144 #define CUPS_DEFAULT_DEFAULT_SHARED 1
145
146
147 /*
148 * Default IPP port...
149 */
150
151 #define CUPS_DEFAULT_IPP_PORT 631
152
153
154 /*
155 * Default printcap file...
156 */
157
158 #define CUPS_DEFAULT_PRINTCAP ""
159
160
161 /*
162 * Default Samba and LPD config files...
163 */
164
165 #define CUPS_DEFAULT_SMB_CONFIG_FILE ""
166 #define CUPS_DEFAULT_LPD_CONFIG_FILE ""
167
168
169 /*
170 * Default MaxCopies value...
171 */
172
173 #define CUPS_DEFAULT_MAX_COPIES 9999
174
175
176 /*
177 * Do we have domain socket support, and if so what is the default one?
178 */
179
180 #undef CUPS_DEFAULT_DOMAINSOCKET
181
182
183 /*
184 * Default WebInterface value...
185 */
186
187 #define CUPS_DEFAULT_WEBIF 0
188
189
190 /*
191 * Where are files stored?
192 *
193 * Note: These are defaults, which can be overridden by environment
194 * variables at run-time...
195 */
196
197 #define CUPS_BINDIR "C:/CUPS/bin"
198 #define CUPS_CACHEDIR "C:/CUPS/cache"
199 #define CUPS_DATADIR "C:/CUPS/share"
200 #define CUPS_DOCROOT "C:/CUPS/share/doc"
201 #define CUPS_FONTPATH "C:/CUPS/share/fonts"
202 #define CUPS_LOCALEDIR "C:/CUPS/locale"
203 #define CUPS_LOGDIR "C:/CUPS/logs"
204 #define CUPS_REQUESTS "C:/CUPS/spool"
205 #define CUPS_SBINDIR "C:/CUPS/sbin"
206 #define CUPS_SERVERBIN "C:/CUPS/lib"
207 #define CUPS_SERVERROOT "C:/CUPS/etc"
208 #define CUPS_STATEDIR "C:/CUPS/run"
209
210
211 /*
212 * Do we have posix_spawn?
213 */
214
215 /* #undef HAVE_POSIX_SPAWN */
216
217
218 /*
219 * Do we have ZLIB?
220 */
221
222 #define HAVE_LIBZ 1
223 #define HAVE_INFLATECOPY 1
224
225
226 /*
227 * Do we have PAM stuff?
228 */
229
230 #define HAVE_LIBPAM 0
231 /* #undef HAVE_PAM_PAM_APPL_H */
232 /* #undef HAVE_PAM_SET_ITEM */
233 /* #undef HAVE_PAM_SETCRED */
234
235
236 /*
237 * Do we have <shadow.h>?
238 */
239
240 /* #undef HAVE_SHADOW_H */
241
242
243 /*
244 * Do we have <crypt.h>?
245 */
246
247 /* #undef HAVE_CRYPT_H */
248
249
250 /*
251 * Use <stdint.h>?
252 */
253
254 /* #undef HAVE_STDINT_H */
255
256
257 /*
258 * Use <string.h>, <strings.h>, and/or <bstring.h>?
259 */
260
261 #define HAVE_STRING_H 1
262 /* #undef HAVE_STRINGS_H */
263 /* #undef HAVE_BSTRING_H */
264
265
266 /*
267 * Do we have the long long type?
268 */
269
270 /* #undef HAVE_LONG_LONG */
271
272 #ifdef HAVE_LONG_LONG
273 # define CUPS_LLFMT "%lld"
274 # define CUPS_LLCAST (long long)
275 #else
276 # define CUPS_LLFMT "%ld"
277 # define CUPS_LLCAST (long)
278 #endif /* HAVE_LONG_LONG */
279
280
281 /*
282 * Do we have the strtoll() function?
283 */
284
285 /* #undef HAVE_STRTOLL */
286
287 #ifndef HAVE_STRTOLL
288 # define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
289 #endif /* !HAVE_STRTOLL */
290
291
292 /*
293 * Do we have the strXXX() functions?
294 */
295
296 #define HAVE_STRDUP 1
297 /* #undef HAVE_STRLCAT */
298 /* #undef HAVE_STRLCPY */
299
300
301 /*
302 * Do we have the geteuid() function?
303 */
304
305 /* #undef HAVE_GETEUID */
306
307
308 /*
309 * Do we have the setpgid() function?
310 */
311
312 /* #undef HAVE_SETPGID */
313
314
315 /*
316 * Do we have the vsyslog() function?
317 */
318
319 /* #undef HAVE_VSYSLOG */
320
321
322 /*
323 * Do we have the systemd journal functions?
324 */
325
326 /* #undef HAVE_SYSTEMD_SD_JOURNAL_H */
327
328
329 /*
330 * Do we have the (v)snprintf() functions?
331 */
332
333 /* Windows snprintf/vsnprintf are non-conforming */
334 /* #undef HAVE_SNPRINTF */
335 /* #undef HAVE_VSNPRINTF */
336
337
338 /*
339 * What signal functions to use?
340 */
341
342 /* #undef HAVE_SIGSET */
343 /* #undef HAVE_SIGACTION */
344
345
346 /*
347 * What wait functions to use?
348 */
349
350 /* #undef HAVE_WAITPID */
351 /* #undef HAVE_WAIT3 */
352
353
354 /*
355 * Do we have the mallinfo function and malloc.h?
356 */
357
358 /* #undef HAVE_MALLINFO */
359 /* #undef HAVE_MALLOC_H */
360
361
362 /*
363 * Do we have the POSIX ACL functions?
364 */
365
366 /* #undef HAVE_ACL_INIT */
367
368
369 /*
370 * Do we have the langinfo.h header file?
371 */
372
373 /* #undef HAVE_LANGINFO_H */
374
375
376 /*
377 * Which encryption libraries do we have?
378 */
379
380 /* #undef HAVE_CDSASSL */
381 /* #undef HAVE_GNUTLS */
382 #define HAVE_SSPISSL 1
383 #define HAVE_SSL 1
384
385
386 /*
387 * Do we have the gnutls_transport_set_pull_timeout_function function?
388 */
389
390 /* #undef HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION */
391
392
393 /*
394 * Do we have the gnutls_priority_set_direct function?
395 */
396
397 /* #undef HAVE_GNUTLS_PRIORITY_SET_DIRECT */
398
399
400 /*
401 * What Security framework headers do we have?
402 */
403
404 /* #undef HAVE_AUTHORIZATION_H */
405 /* #undef HAVE_SECCERTIFICATE_H */
406 /* #undef HAVE_SECITEM_H */
407 /* #undef HAVE_SECPOLICY_H */
408
409
410 /*
411 * Do we have the SecGenerateSelfSignedCertificate function?
412 */
413
414 /* #undef HAVE_SECGENERATESELFSIGNEDCERTIFICATE */
415
416
417 /*
418 * Do we have libpaper?
419 */
420
421 /* #undef HAVE_LIBPAPER */
422
423
424 /*
425 * Do we have mDNSResponder for DNS Service Discovery (aka Bonjour)?
426 */
427
428 #define HAVE_DNSSD 1
429
430
431 /*
432 * Do we have Avahi for DNS Service Discovery (aka Bonjour)?
433 */
434
435 #undef HAVE_AVAHI
436
437
438 /*
439 * Do we have <sys/ioctl.h>?
440 */
441
442 #undef HAVE_SYS_IOCTL_H
443
444
445 /*
446 * Does the "stat" structure contain the "st_gen" member?
447 */
448
449 /* #undef HAVE_ST_GEN */
450
451
452 /*
453 * Does the "tm" structure contain the "tm_gmtoff" member?
454 */
455
456 /* #undef HAVE_TM_GMTOFF */
457
458
459 /*
460 * Do we have rresvport_af()?
461 */
462
463 /* #undef HAVE_RRESVPORT_AF */
464
465
466 /*
467 * Do we have getaddrinfo()?
468 */
469
470 #define HAVE_GETADDRINFO 1
471
472
473 /*
474 * Do we have getnameinfo()?
475 */
476
477 #define HAVE_GETNAMEINFO 1
478
479
480 /*
481 * Do we have getifaddrs()?
482 */
483
484 /* #undef HAVE_GETIFADDRS */
485
486
487 /*
488 * Do we have hstrerror()?
489 */
490
491 /* #undef HAVE_HSTRERROR */
492
493
494 /*
495 * Do we have res_init()?
496 */
497
498 /* #undef HAVE_RES_INIT */
499
500
501 /*
502 * Do we have <resolv.h>
503 */
504
505 /* #undef HAVE_RESOLV_H */
506
507
508 /*
509 * Do we have the <sys/sockio.h> header file?
510 */
511
512 /* #undef HAVE_SYS_SOCKIO_H */
513
514
515 /*
516 * Does the sockaddr structure contain an sa_len parameter?
517 */
518
519 /* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
520
521
522 /*
523 * Do we have pthread support?
524 */
525
526 /* #undef HAVE_PTHREAD_H */
527
528
529 /*
530 * Do we have on-demand support (launchd/systemd/upstart)?
531 */
532
533 /* #undef HAVE_ONDEMAND */
534
535
536 /*
537 * Do we have launchd support?
538 */
539
540 /* #undef HAVE_LAUNCH_H */
541 /* #undef HAVE_LAUNCHD */
542
543
544 /*
545 * Do we have systemd support?
546 */
547
548 /* #undef HAVE_SYSTEMD */
549
550
551 /*
552 * Do we have upstart support?
553 */
554
555 /* #undef HAVE_UPSTART */
556
557
558 /*
559 * Do we have CoreFoundation public headers?
560 */
561
562 /* #undef HAVE_COREFOUNDATION_H */
563
564
565 /*
566 * Do we have ApplicationServices public headers?
567 */
568
569 /* #undef HAVE_APPLICATIONSERVICES_H */
570
571
572 /*
573 * Do we have the SCDynamicStoreCopyComputerName function?
574 */
575
576 /* #undef HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME */
577
578
579 /*
580 * Do we have the getgrouplist() function?
581 */
582
583 #undef HAVE_GETGROUPLIST
584
585
586 /*
587 * Do we have macOS 10.4's mbr_XXX functions?
588 */
589
590 /* #undef HAVE_MEMBERSHIP_H */
591 /* #undef HAVE_MBR_UID_TO_UUID */
592
593
594 /*
595 * Do we have Darwin's notify_post header and function?
596 */
597
598 /* #undef HAVE_NOTIFY_H */
599 /* #undef HAVE_NOTIFY_POST */
600
601
602 /*
603 * Do we have DBUS?
604 */
605
606 /* #undef HAVE_DBUS */
607 /* #undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND */
608 /* #undef HAVE_DBUS_THREADS_INIT */
609
610
611 /*
612 * Do we have the GSSAPI support library (for Kerberos support)?
613 */
614
615 /* #undef HAVE_GSS_ACQUIRE_CRED_EX_F */
616 /* #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE */
617 /* #undef HAVE_GSS_GSSAPI_H */
618 /* #undef HAVE_GSS_GSSAPI_SPI_H */
619 /* #undef HAVE_GSSAPI */
620 /* #undef HAVE_GSSAPI_GSSAPI_H */
621 /* #undef HAVE_GSSAPI_H */
622
623
624 /*
625 * Default GSS service name...
626 */
627
628 #define CUPS_DEFAULT_GSSSERVICENAME "host"
629
630
631 /*
632 * Select/poll interfaces...
633 */
634
635 /* #undef HAVE_POLL */
636 /* #undef HAVE_EPOLL */
637 /* #undef HAVE_KQUEUE */
638
639
640 /*
641 * Do we have the <dlfcn.h> header?
642 */
643
644 /* #undef HAVE_DLFCN_H */
645
646
647 /*
648 * Do we have <sys/param.h>?
649 */
650
651 /* #undef HAVE_SYS_PARAM_H */
652
653
654 /*
655 * Do we have <sys/ucred.h>?
656 */
657
658 /* #undef HAVE_SYS_UCRED_H */
659
660
661 /*
662 * Do we have removefile()?
663 */
664
665 /* #undef HAVE_REMOVEFILE */
666
667
668 /*
669 * Do we have <sandbox.h>?
670 */
671
672 /* #undef HAVE_SANDBOX_H */
673
674
675 /*
676 * Which random number generator function to use...
677 */
678
679 /* #undef HAVE_ARC4RANDOM */
680 /* #undef HAVE_RANDOM */
681 /* #undef HAVE_LRAND48 */
682
683 #ifdef HAVE_ARC4RANDOM
684 # define CUPS_RAND() arc4random()
685 # define CUPS_SRAND(v)
686 #elif defined(HAVE_RANDOM)
687 # define CUPS_RAND() random()
688 # define CUPS_SRAND(v) srandom(v)
689 #elif defined(HAVE_LRAND48)
690 # define CUPS_RAND() lrand48()
691 # define CUPS_SRAND(v) srand48(v)
692 #else
693 # define CUPS_RAND() rand()
694 # define CUPS_SRAND(v) srand(v)
695 #endif /* HAVE_ARC4RANDOM */
696
697
698 /*
699 * Do we have libusb?
700 */
701
702 /* #undef HAVE_LIBUSB */
703
704
705 /*
706 * Do we have libwrap and tcpd.h?
707 */
708
709 /* #undef HAVE_TCPD_H */
710
711
712 /*
713 * Do we have <iconv.h>?
714 */
715
716 /* #undef HAVE_ICONV_H */
717
718
719 /*
720 * Do we have statfs or statvfs and one of the corresponding headers?
721 */
722
723 /* #undef HAVE_STATFS */
724 /* #undef HAVE_STATVFS */
725 /* #undef HAVE_SYS_MOUNT_H */
726 /* #undef HAVE_SYS_STATFS_H */
727 /* #undef HAVE_SYS_STATVFS_H */
728 /* #undef HAVE_SYS_VFS_H */
729
730
731 /*
732 * Location of macOS localization bundle, if any.
733 */
734
735 /* #undef CUPS_BUNDLEDIR */
736
737
738 /*
739 * Do we have XPC?
740 */
741
742 /* #undef HAVE_XPC */
743
744
745 /*
746 * Do we have the C99 abs() function?
747 */
748
749 /* #undef HAVE_ABS */
750 #if !defined(HAVE_ABS) && !defined(abs)
751 # if defined(__GNUC__) || __STDC_VERSION__ >= 199901L
752 # define abs(x) _cups_abs(x)
_cups_abs(int i)753 static inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
754 # elif defined(_MSC_VER)
755 # define abs(x) _cups_abs(x)
_cups_abs(int i)756 static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
757 # else
758 # define abs(x) ((x) < 0 ? -(x) : (x))
759 # endif /* __GNUC__ || __STDC_VERSION__ */
760 #endif /* !HAVE_ABS && !abs */
761
762 #endif /* !_CUPS_CONFIG_H_ */
763