[BACK]Return to cvsd.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Annotation of src/usr.bin/cvs/cvsd.h, Revision 1.1.1.1

1.1       jfb         1: /*     $OpenBSD$       */
                      2: /*
                      3:  * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
                      4:  * All rights reserved.
                      5:  *
                      6:  * Redistribution and use in source and binary forms, with or without
                      7:  * modification, are permitted provided that the following conditions
                      8:  * are met:
                      9:  *
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. The name of the author may not be used to endorse or promote products
                     13:  *    derived from this software without specific prior written permission.
                     14:  *
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
                     16:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
                     17:  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
                     18:  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
                     19:  * EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
                     20:  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
                     21:  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
                     22:  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
                     23:  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
                     24:  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     25:  */
                     26:
                     27: #ifndef CVSD_H
                     28: #define CVSD_H
                     29:
                     30: #include <sys/types.h>
                     31: #include <sys/queue.h>
                     32: #include <sys/stat.h>
                     33:
                     34: #include <pwd.h>
                     35: #include <signal.h>
                     36:
                     37: #include "cvs.h"
                     38:
                     39: #define CVSD_USER   "_cvsd"
                     40: #define CVSD_GROUP  "_cvsd"
                     41:
                     42: #define CVSD_CHILD_DEFMIN    3
                     43: #define CVSD_CHILD_DEFMAX    5
                     44:
                     45:
                     46:
                     47: #define CVSD_FPERM  (S_IRUSR | S_IWUSR)
                     48: #define CVSD_DPERM  (S_IRWXU)
                     49:
                     50:
                     51: /* requests */
                     52: #define CVSD_MSG_GETUID    1
                     53: #define CVSD_MSG_GETUNAME  2
                     54: #define CVSD_MSG_PASSFD    3   /* server passes client file descriptor */
                     55: #define CVSD_MSG_SETIDLE   4   /* client has no further processing to do */
                     56:
                     57: /* replies */
                     58: #define CVSD_MSG_UID       128
                     59: #define CVSD_MSG_UNAME     129
                     60:
                     61: #define CVSD_MSG_SHUTDOWN  253
                     62: #define CVSD_MSG_OK        254
                     63: #define CVSD_MSG_ERROR     255
                     64:
                     65: #define CVSD_MSG_MAXLEN    256
                     66:
                     67:
                     68: /* message structure to pass data between the parent and the chrooted child */
                     69: struct cvsd_msg {
                     70:        u_int8_t  cm_type;
                     71:        u_int8_t  cm_len;    /* length of message data in bytes */
                     72: };
                     73:
                     74:
                     75: struct cvsd_child {
                     76:        pid_t  ch_pid;
                     77:        int    ch_sock;
                     78:
                     79:        TAILQ_ENTRY(cvsd_child) ch_list;
                     80: };
                     81:
                     82:
                     83:
                     84: extern int foreground;
                     85:
                     86: extern volatile sig_atomic_t running;
                     87: extern volatile sig_atomic_t restart;
                     88:
                     89:
                     90:
                     91:
                     92:
                     93:
                     94: int  cvsd_checkperms (const char *);
                     95: int  cvsd_forkchild  (void);
                     96:
                     97:
                     98: /* from aclparse.y */
                     99: int    cvs_acl_parse  (const char *);
                    100: u_int  cvs_acl_eval   (struct cvs_op *);
                    101:
                    102: /* from msg.c */
                    103: int    cvsd_sendmsg (int, u_int, const void *, size_t);
                    104: int    cvsd_recvmsg (int, u_int *, void *, size_t *);
                    105:
                    106: #endif /* CVSD_H */