4 * Process management routines for the CUPS scheduler.
6 * Copyright 2007-2014 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
17 * Include necessary headers...
24 #endif /* __APPLE__ */
25 #ifdef HAVE_POSIX_SPAWN
27 extern char **environ
;
28 #endif /* HAVE_POSIX_SPAWN */
32 * Process structure...
37 int pid
, /* Process ID */
38 job_id
; /* Job associated with process */
39 char name
[1]; /* Name of process */
47 static cups_array_t
*process_array
= NULL
;
54 static int compare_procs(cupsd_proc_t
*a
, cupsd_proc_t
*b
);
56 static char *cupsd_requote(char *dst
, const char *src
, size_t dstsize
);
57 #endif /* HAVE_SANDBOX_H */
61 * 'cupsdCreateProfile()' - Create an execution profile for a subprocess.
64 void * /* O - Profile or NULL on error */
65 cupsdCreateProfile(int job_id
, /* I - Job ID or 0 for none */
66 int allow_networking
)/* I - Allow networking off machine? */
69 cups_file_t
*fp
; /* File pointer */
70 char profile
[1024], /* File containing the profile */
71 bin
[1024], /* Quoted ServerBin */
72 cache
[1024], /* Quoted CacheDir */
73 domain
[1024], /* Domain socket, if any */
74 request
[1024], /* Quoted RequestRoot */
75 root
[1024], /* Quoted ServerRoot */
76 temp
[1024]; /* Quoted TempDir */
77 const char *nodebug
; /* " (with no-log)" for no debug */
78 cupsd_listener_t
*lis
; /* Current listening socket */
81 if (!UseSandboxing
|| Sandboxing
== CUPSD_SANDBOXING_OFF
)
84 * Only use sandbox profiles as root...
87 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdCreateProfile(job_id=%d, allow_networking=%d) = NULL", job_id
, allow_networking
);
92 if ((fp
= cupsTempFile2(profile
, sizeof(profile
))) == NULL
)
94 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdCreateProfile(job_id=%d, allow_networking=%d) = NULL", job_id
, allow_networking
);
95 cupsdLogMessage(CUPSD_LOG_ERROR
, "Unable to create security profile: %s",
100 fchown(cupsFileNumber(fp
), RunUser
, Group
);
101 fchmod(cupsFileNumber(fp
), 0640);
103 cupsd_requote(bin
, ServerBin
, sizeof(bin
));
104 cupsd_requote(cache
, CacheDir
, sizeof(cache
));
105 cupsd_requote(request
, RequestRoot
, sizeof(request
));
106 cupsd_requote(root
, ServerRoot
, sizeof(root
));
107 cupsd_requote(temp
, TempDir
, sizeof(temp
));
109 nodebug
= LogLevel
< CUPSD_LOG_DEBUG
? " (with no-log)" : "";
111 cupsFilePuts(fp
, "(version 1)\n");
112 if (Sandboxing
== CUPSD_SANDBOXING_STRICT
)
113 cupsFilePuts(fp
, "(deny default)\n");
115 cupsFilePuts(fp
, "(allow default)\n");
116 if (LogLevel
>= CUPSD_LOG_DEBUG
)
117 cupsFilePuts(fp
, "(debug deny)\n");
118 cupsFilePuts(fp
, "(import \"system.sb\")\n");
119 cupsFilePuts(fp
, "(system-network)\n");
120 cupsFilePuts(fp
, "(allow mach-per-user-lookup)\n");
121 cupsFilePuts(fp
, "(allow ipc-posix-sem)\n");
122 cupsFilePuts(fp
, "(allow ipc-posix-shm)\n");
123 cupsFilePuts(fp
, "(allow ipc-sysv-shm)\n");
124 cupsFilePuts(fp
, "(allow mach-lookup)\n");
126 "(deny file-write* file-read-data file-read-metadata\n"
128 " #\"^%s$\"" /* RequestRoot */
129 " #\"^%s/\"" /* RequestRoot/... */
131 request
, request
, nodebug
);
134 "(deny file-write* file-read-data file-read-metadata\n"
140 "(deny file-write*\n"
142 " #\"^%s$\"" /* ServerRoot */
143 " #\"^%s/\"" /* ServerRoot/... */
144 " #\"^/private/etc$\""
145 " #\"^/private/etc/\""
146 " #\"^/usr/local/etc$\""
147 " #\"^/usr/local/etc/\""
153 root
, root
, nodebug
);
154 /* Specifically allow applications to stat RequestRoot and some other system folders */
156 "(allow file-read-metadata\n"
159 " #\"^/usr$\"" /* /usr */
160 " #\"^/Library$\"" /* /Library */
161 " #\"^/Library/Printers$\"" /* /Library/Printers */
162 " #\"^%s$\"" /* RequestRoot */
165 /* Read and write TempDir, CacheDir, and other common folders */
167 "(allow file-write* file-read-data file-read-metadata\n"
169 " #\"^%s$\"" /* TempDir */
170 " #\"^%s/\"" /* TempDir/... */
171 " #\"^%s$\"" /* CacheDir */
172 " #\"^%s/\"" /* CacheDir/... */
173 " #\"^/private/var/db/\""
174 " #\"^/private/var/folders/\""
175 " #\"^/private/var/run/\""
176 " #\"^/Library/Application Support/\""
177 " #\"^/Library/Caches/\""
178 " #\"^/Library/Preferences/\""
179 " #\"^/Users/Shared/\""
181 temp
, temp
, cache
, cache
);
182 /* Read common folders */
184 "(allow file-read-data file-read-metadata\n"
186 " #\"^/AppleInternal$\""
187 " #\"^/AppleInternal/\""
188 " #\"^/bin$\"" /* /bin */
189 " #\"^/bin/\"" /* /bin/... */
191 " #\"^/private/etc/services$\""
192 " #\"^/private/var$\""
193 " #\"^/private/var/db$\""
194 " #\"^/private/var/spool$\""
195 " #\"^/usr/bin$\"" /* /usr/bin */
196 " #\"^/usr/bin/\"" /* /usr/bin/... */
197 " #\"^/usr/libexec/cups$\"" /* /usr/libexec/cups */
198 " #\"^/usr/libexec/cups/\"" /* /usr/libexec/cups/... */
199 " #\"^/usr/sbin$\"" /* /usr/sbin */
200 " #\"^/usr/sbin/\"" /* /usr/sbin/... */
201 " #\"^/Library/Caches$\""
202 " #\"^/Library/Fonts$\""
203 " #\"^/Library/Fonts/\""
204 " #\"^/Library/Keychains$\""
205 " #\"^/Library/Keychains/\""
206 " #\"^/Library/Printers$\""
207 " #\"^/Library/Printers/\""
208 " #\"^%s/Library$\"" /* RequestRoot/Library */
209 " #\"^%s/Library/\"" /* RequestRoot/Library/... */
210 " #\"^%s$\"" /* ServerBin */
211 " #\"^%s/\"" /* ServerBin/... */
212 " #\"^%s$\"" /* ServerRoot */
213 " #\"^%s/\"" /* ServerRoot/... */
215 request
, request
, bin
, bin
, root
, root
);
216 if (Sandboxing
== CUPSD_SANDBOXING_RELAXED
)
218 /* Limited write access to /Library/Printers/... */
220 "(allow file-write*\n"
222 " #\"^/Library/Printers/.*/\""
225 "(deny file-write*\n"
227 " #\"^/Library/Printers/PPDs$\""
228 " #\"^/Library/Printers/PPDs/\""
229 " #\"^/Library/Printers/PPD Plugins$\""
230 " #\"^/Library/Printers/PPD Plugins/\""
233 /* Allow execution of child processes */
234 cupsFilePuts(fp
, "(allow process-fork)\n");
236 "(allow process-exec\n"
238 " #\"^/bin/\"" /* /bin/... */
239 " #\"^/usr/bin/\"" /* /usr/bin/... */
240 " #\"^/usr/libexec/cups/\"" /* /usr/libexec/cups/... */
241 " #\"^/usr/libexec/fax/\"" /* /usr/libexec/fax/... */
242 " #\"^/usr/sbin/\"" /* /usr/sbin/... */
243 " #\"^%s/\"" /* ServerBin/... */
244 " #\"^/Library/Printers/.*/\""
247 if (RunUser
&& getenv("CUPS_TESTROOT"))
249 /* Allow source directory access in "make test" environment */
250 char testroot
[1024]; /* Root directory of test files */
252 cupsd_requote(testroot
, getenv("CUPS_TESTROOT"), sizeof(testroot
));
255 "(allow file-write* file-read-data file-read-metadata\n"
257 " #\"^%s$\"" /* CUPS_TESTROOT */
258 " #\"^%s/\"" /* CUPS_TESTROOT/... */
262 "(allow process-exec\n"
264 " #\"^%s/\"" /* CUPS_TESTROOT/... */
270 /* Allow job filters to read the current job files... */
272 "(allow file-read-data file-read-metadata\n"
273 " (regex #\"^%s/([ac]%05d|d%05d-[0-9][0-9][0-9])$\"))\n",
274 request
, job_id
, job_id
);
278 /* Allow email notifications from notifiers... */
280 "(allow process-exec\n"
281 " (literal \"/usr/sbin/sendmail\")\n"
282 " (with no-sandbox))\n");
284 /* Allow outbound networking to local services */
285 cupsFilePuts(fp
, "(allow network-outbound"
286 "\n (regex #\"^/private/var/run/\")");
287 for (lis
= (cupsd_listener_t
*)cupsArrayFirst(Listeners
);
289 lis
= (cupsd_listener_t
*)cupsArrayNext(Listeners
))
291 if (httpAddrFamily(&(lis
->address
)) == AF_LOCAL
)
293 httpAddrString(&(lis
->address
), domain
, sizeof(domain
));
294 cupsFilePrintf(fp
, "\n (literal \"%s\")", domain
);
297 if (allow_networking
)
299 /* Allow TCP and UDP networking off the machine... */
300 cupsFilePuts(fp
, "\n (remote tcp))\n");
301 cupsFilePuts(fp
, "(allow network-bind)\n"); /* for LPD resvport */
302 cupsFilePuts(fp
, "(allow network*\n"
303 " (local udp \"*:*\")\n"
304 " (remote udp \"*:*\"))\n");
306 /* Also allow access to Bluetooth, USB, and device files */
307 cupsFilePuts(fp
, "(allow iokit-open)\n");
308 cupsFilePuts(fp
, "(allow file-write* file-read-data file-read-metadata file-ioctl\n"
309 " (regex #\"^/dev/\"))\n");
313 /* Only allow SNMP (UDP) off the machine... */
314 cupsFilePuts(fp
, ")\n");
315 cupsFilePuts(fp
, "(allow network-outbound\n"
316 " (remote udp \"*:161\"))\n");
317 cupsFilePuts(fp
, "(allow network-inbound\n"
318 " (local udp \"localhost:*\"))\n");
322 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdCreateProfile(job_id=%d,allow_networking=%d) = \"%s\"", job_id
, allow_networking
, profile
);
323 return ((void *)strdup(profile
));
326 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdCreateProfile(job_id=%d, allow_networking=%d) = NULL", job_id
, allow_networking
);
329 #endif /* HAVE_SANDBOX_H */
334 * 'cupsdDestroyProfile()' - Delete an execution profile.
338 cupsdDestroyProfile(void *profile
) /* I - Profile */
340 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdDeleteProfile(profile=\"%s\")",
341 profile
? (char *)profile
: "(null)");
343 #ifdef HAVE_SANDBOX_H
346 unlink((char *)profile
);
349 #endif /* HAVE_SANDBOX_H */
354 * 'cupsdEndProcess()' - End a process.
357 int /* O - 0 on success, -1 on failure */
358 cupsdEndProcess(int pid
, /* I - Process ID */
359 int force
) /* I - Force child to die */
361 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdEndProcess(pid=%d, force=%d)", pid
,
370 * When running as root, cupsd puts child processes in their own process
371 * group. Using "-pid" sends a signal to all processes in the group.
378 return (kill(pid
, SIGKILL
));
380 return (kill(pid
, SIGTERM
));
385 * 'cupsdFinishProcess()' - Finish a process and get its name.
388 const char * /* O - Process name */
389 cupsdFinishProcess(int pid
, /* I - Process ID */
390 char *name
, /* I - Name buffer */
391 size_t namelen
, /* I - Size of name buffer */
392 int *job_id
) /* O - Job ID pointer or NULL */
394 cupsd_proc_t key
, /* Search key */
395 *proc
; /* Matching process */
400 if ((proc
= (cupsd_proc_t
*)cupsArrayFind(process_array
, &key
)) != NULL
)
403 *job_id
= proc
->job_id
;
405 strlcpy(name
, proc
->name
, namelen
);
406 cupsArrayRemove(process_array
, proc
);
414 strlcpy(name
, "unknown", namelen
);
417 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdFinishProcess(pid=%d, name=%p, namelen=" CUPS_LLFMT
", job_id=%p(%d)) = \"%s\"", pid
, name
, CUPS_LLCAST namelen
, job_id
, job_id
? *job_id
: 0, name
);
424 * 'cupsdStartProcess()' - Start a process.
427 int /* O - Process ID or 0 */
429 const char *command
, /* I - Full path to command */
430 char *argv
[], /* I - Command-line arguments */
431 char *envp
[], /* I - Environment */
432 int infd
, /* I - Standard input file descriptor */
433 int outfd
, /* I - Standard output file descriptor */
434 int errfd
, /* I - Standard error file descriptor */
435 int backfd
, /* I - Backchannel file descriptor */
436 int sidefd
, /* I - Sidechannel file descriptor */
437 int root
, /* I - Run as root? */
438 void *profile
, /* I - Security profile to use */
439 cupsd_job_t
*job
, /* I - Job associated with process */
440 int *pid
) /* O - Process ID */
442 int i
; /* Looping var */
443 const char *exec_path
= command
; /* Command to be exec'd */
444 char *real_argv
[110], /* Real command-line arguments */
445 cups_exec
[1024]; /* Path to "cups-exec" program */
446 uid_t user
; /* Command UID */
447 cupsd_proc_t
*proc
; /* New process record */
448 #ifdef HAVE_POSIX_SPAWN
449 posix_spawn_file_actions_t actions
; /* Spawn file actions */
450 posix_spawnattr_t attrs
; /* Spawn attributes */
451 char user_str
[16], /* User string */
452 group_str
[16], /* Group string */
453 nice_str
[16]; /* FilterNice string */
454 #elif defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
455 struct sigaction action
; /* POSIX signal handler */
456 #endif /* HAVE_POSIX_SPAWN */
457 #if defined(__APPLE__)
458 char processPath
[1024], /* CFProcessPath environment variable */
459 linkpath
[1024]; /* Link path for symlinks... */
460 int linkbytes
; /* Bytes for link path */
461 #endif /* __APPLE__ */
467 * Figure out the UID for the child process...
478 * Check the permissions of the command we are running...
481 if (_cupsFileCheck(command
, _CUPS_FILE_CHECK_PROGRAM
, !RunUser
,
482 cupsdLogFCMessage
, job
? job
->printer
: NULL
))
485 #if defined(__APPLE__)
489 * Add special voodoo magic for OS X - this allows OS X programs to access
490 * their bundle resources properly...
493 if ((linkbytes
= readlink(command
, linkpath
, sizeof(linkpath
) - 1)) > 0)
496 * Yes, this is a symlink to the actual program, nul-terminate and
500 linkpath
[linkbytes
] = '\0';
502 if (linkpath
[0] == '/')
503 snprintf(processPath
, sizeof(processPath
), "CFProcessPath=%s",
506 snprintf(processPath
, sizeof(processPath
), "CFProcessPath=%s/%s",
507 dirname((char *)command
), linkpath
);
510 snprintf(processPath
, sizeof(processPath
), "CFProcessPath=%s", command
);
512 envp
[0] = processPath
; /* Replace <CFProcessPath> string */
514 #endif /* __APPLE__ */
517 * Use helper program when we have a sandbox profile...
520 #ifndef HAVE_POSIX_SPAWN
522 #endif /* !HAVE_POSIX_SPAWN */
524 snprintf(cups_exec
, sizeof(cups_exec
), "%s/daemon/cups-exec", ServerBin
);
525 snprintf(user_str
, sizeof(user_str
), "%d", user
);
526 snprintf(group_str
, sizeof(group_str
), "%d", Group
);
527 snprintf(nice_str
, sizeof(nice_str
), "%d", FilterNice
);
529 real_argv
[0] = cups_exec
;
530 real_argv
[1] = (char *)"-g";
531 real_argv
[2] = group_str
;
532 real_argv
[3] = (char *)"-n";
533 real_argv
[4] = nice_str
;
534 real_argv
[5] = (char *)"-u";
535 real_argv
[6] = user_str
;
536 real_argv
[7] = profile
;
537 real_argv
[8] = (char *)command
;
540 i
< (int)(sizeof(real_argv
) / sizeof(real_argv
[0]) - 10) && argv
[i
];
542 real_argv
[i
+ 9] = argv
[i
];
544 real_argv
[i
+ 9] = NULL
;
547 exec_path
= cups_exec
;
550 if (LogLevel
== CUPSD_LOG_DEBUG2
)
552 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdStartProcess: Preparing to start \"%s\", arguments:", command
);
554 for (i
= 0; argv
[i
]; i
++)
555 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdStartProcess: argv[%d] = \"%s\"", i
, argv
[i
]);
558 #ifdef HAVE_POSIX_SPAWN
560 * Setup attributes and file actions for the spawn...
563 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdStartProcess: Setting spawn attributes.");
564 posix_spawnattr_init(&attrs
);
565 posix_spawnattr_setflags(&attrs
, POSIX_SPAWN_SETPGROUP
| POSIX_SPAWN_SETSIGDEF
);
567 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdStartProcess: Setting file actions.");
568 posix_spawn_file_actions_init(&actions
);
572 posix_spawn_file_actions_addopen(&actions
, 0, "/dev/null", O_WRONLY
, 0);
574 posix_spawn_file_actions_adddup2(&actions
, infd
, 0);
580 posix_spawn_file_actions_addopen(&actions
, 1, "/dev/null", O_WRONLY
, 0);
582 posix_spawn_file_actions_adddup2(&actions
, outfd
, 1);
588 posix_spawn_file_actions_addopen(&actions
, 2, "/dev/null", O_WRONLY
, 0);
590 posix_spawn_file_actions_adddup2(&actions
, errfd
, 2);
593 if (backfd
!= 3 && backfd
>= 0)
594 posix_spawn_file_actions_adddup2(&actions
, backfd
, 3);
596 if (sidefd
!= 4 && sidefd
>= 0)
597 posix_spawn_file_actions_adddup2(&actions
, sidefd
, 4);
599 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdStartProcess: Calling posix_spawn.");
601 if (posix_spawn(pid
, exec_path
, &actions
, &attrs
, argv
, envp
? envp
: environ
))
603 cupsdLogMessage(CUPSD_LOG_ERROR
, "Unable to fork %s - %s.", command
, strerror(errno
));
608 cupsdLogMessage(CUPSD_LOG_DEBUG2
, "cupsdStartProcess: pid=%d", (int)*pid
);
610 posix_spawn_file_actions_destroy(&actions
);
611 posix_spawnattr_destroy(&attrs
);
615 * Block signals before forking...
620 if ((*pid
= fork()) == 0)
623 * Child process goes here; update stderr as needed...
629 errfd
= open("/dev/null", O_WRONLY
);
639 * Put this process in its own process group so that we can kill any child
640 * processes it creates.
644 if (!RunUser
&& setpgid(0, 0))
647 if (!RunUser
&& setpgrp())
649 # endif /* HAVE_SETPGID */
652 * Update the remaining file descriptors as needed...
658 infd
= open("/dev/null", O_RDONLY
);
670 outfd
= open("/dev/null", O_WRONLY
);
679 if (backfd
!= 3 && backfd
>= 0)
683 fcntl(3, F_SETFL
, O_NDELAY
);
686 if (sidefd
!= 4 && sidefd
>= 0)
690 fcntl(4, F_SETFL
, O_NDELAY
);
694 * Change the priority of the process based on the FilterNice setting.
695 * (this is not done for root processes...)
702 * Reset group membership to just the main one we belong to.
705 if (!RunUser
&& setgid(Group
))
708 if (!RunUser
&& setgroups(1, &Group
))
712 * Change user to something "safe"...
715 if (!RunUser
&& user
&& setuid(user
))
719 * Change umask to restrict permissions on created files...
725 * Unblock signals before doing the exec...
729 sigset(SIGTERM
, SIG_DFL
);
730 sigset(SIGCHLD
, SIG_DFL
);
731 sigset(SIGPIPE
, SIG_DFL
);
732 # elif defined(HAVE_SIGACTION)
733 memset(&action
, 0, sizeof(action
));
735 sigemptyset(&action
.sa_mask
);
736 action
.sa_handler
= SIG_DFL
;
738 sigaction(SIGTERM
, &action
, NULL
);
739 sigaction(SIGCHLD
, &action
, NULL
);
740 sigaction(SIGPIPE
, &action
, NULL
);
742 signal(SIGTERM
, SIG_DFL
);
743 signal(SIGCHLD
, SIG_DFL
);
744 signal(SIGPIPE
, SIG_DFL
);
745 # endif /* HAVE_SIGSET */
747 cupsdReleaseSignals();
750 * Execute the command; if for some reason this doesn't work, log an error
751 * exit with a non-zero value...
755 execve(exec_path
, argv
, envp
);
757 execv(exec_path
, argv
);
764 * Error - couldn't fork a new process!
767 cupsdLogMessage(CUPSD_LOG_ERROR
, "Unable to fork %s - %s.", command
,
773 cupsdReleaseSignals();
774 #endif /* HAVE_POSIX_SPAWN */
779 process_array
= cupsArrayNew((cups_array_func_t
)compare_procs
, NULL
);
783 if ((proc
= calloc(1, sizeof(cupsd_proc_t
) + strlen(command
))) != NULL
)
786 proc
->job_id
= job
? job
->id
: 0;
787 _cups_strcpy(proc
->name
, command
);
789 cupsArrayAdd(process_array
, proc
);
794 cupsdLogMessage(CUPSD_LOG_DEBUG2
,
795 "cupsdStartProcess(command=\"%s\", argv=%p, envp=%p, "
796 "infd=%d, outfd=%d, errfd=%d, backfd=%d, sidefd=%d, root=%d, "
797 "profile=%p, job=%p(%d), pid=%p) = %d",
798 command
, argv
, envp
, infd
, outfd
, errfd
, backfd
, sidefd
,
799 root
, profile
, job
, job
? job
->id
: 0, pid
, *pid
);
806 * 'compare_procs()' - Compare two processes.
809 static int /* O - Result of comparison */
810 compare_procs(cupsd_proc_t
*a
, /* I - First process */
811 cupsd_proc_t
*b
) /* I - Second process */
813 return (a
->pid
- b
->pid
);
817 #ifdef HAVE_SANDBOX_H
819 * 'cupsd_requote()' - Make a regular-expression version of a string.
822 static char * /* O - Quoted string */
823 cupsd_requote(char *dst
, /* I - Destination buffer */
824 const char *src
, /* I - Source string */
825 size_t dstsize
) /* I - Size of destination buffer */
827 int ch
; /* Current character */
828 char *dstptr
, /* Current position in buffer */
829 *dstend
; /* End of destination buffer */
833 dstend
= dst
+ dstsize
- 2;
835 while (*src
&& dstptr
< dstend
)
839 if (ch
== '/' && !*src
)
840 break; /* Don't add trailing slash */
842 if (strchr(".?*()[]^$\\", ch
))
845 *dstptr
++ = (char)ch
;
852 #endif /* HAVE_SANDBOX_H */