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