[BACK]Return to extern.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / libexec / ftpd

Annotation of src/libexec/ftpd/extern.h, Revision 1.23

1.23    ! lukem       1: /*     $NetBSD: extern.h,v 1.22 2000/01/08 11:09:56 lukem Exp $        */
1.19      itojun      2:
1.21      lukem       3: /*-
                      4:  * Copyright (c) 1992, 1993
                      5:  *     The Regents of the University of California.  All rights reserved.
                      6:  *
1.19      itojun      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
1.21      lukem      15:  * 3. All advertising materials mentioning features or use of this software
                     16:  *    must display the following acknowledgement:
                     17:  *     This product includes software developed by the University of
                     18:  *     California, Berkeley and its contributors.
                     19:  * 4. Neither the name of the University nor the names of its contributors
1.19      itojun     20:  *    may be used to endorse or promote products derived from this software
                     21:  *    without specific prior written permission.
1.21      lukem      22:  *
                     23:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.19      itojun     24:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     25:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.21      lukem      26:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.19      itojun     27:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     28:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     29:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     30:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     31:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     32:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     33:  * SUCH DAMAGE.
1.21      lukem      34:  *
                     35:  *     @(#)extern.h    8.2 (Berkeley) 4/4/94
1.19      itojun     36:  */
1.2       cgd        37:
1.1       deraadt    38: /*-
1.22      lukem      39:  * Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
1.21      lukem      40:  * All rights reserved.
                     41:  *
                     42:  * This code is derived from software contributed to The NetBSD Foundation
                     43:  * by Luke Mewburn.
1.1       deraadt    44:  *
                     45:  * Redistribution and use in source and binary forms, with or without
                     46:  * modification, are permitted provided that the following conditions
                     47:  * are met:
                     48:  * 1. Redistributions of source code must retain the above copyright
                     49:  *    notice, this list of conditions and the following disclaimer.
                     50:  * 2. Redistributions in binary form must reproduce the above copyright
                     51:  *    notice, this list of conditions and the following disclaimer in the
                     52:  *    documentation and/or other materials provided with the distribution.
                     53:  * 3. All advertising materials mentioning features or use of this software
                     54:  *    must display the following acknowledgement:
1.21      lukem      55:  *        This product includes software developed by the NetBSD
                     56:  *        Foundation, Inc. and its contributors.
                     57:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     58:  *    contributors may be used to endorse or promote products derived
                     59:  *    from this software without specific prior written permission.
                     60:  *
                     61:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     62:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     63:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     64:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     65:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     66:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     67:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     68:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     69:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     70:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     71:  * POSSIBILITY OF SUCH DAMAGE.
                     72:  */
                     73:
                     74: /*
                     75:  * Copyright (C) 1997 and 1998 WIDE Project.
                     76:  * All rights reserved.
                     77:  *
                     78:  * Redistribution and use in source and binary forms, with or without
                     79:  * modification, are permitted provided that the following conditions
                     80:  * are met:
                     81:  * 1. Redistributions of source code must retain the above copyright
                     82:  *    notice, this list of conditions and the following disclaimer.
                     83:  * 2. Redistributions in binary form must reproduce the above copyright
                     84:  *    notice, this list of conditions and the following disclaimer in the
                     85:  *    documentation and/or other materials provided with the distribution.
                     86:  * 3. Neither the name of the project nor the names of its contributors
1.1       deraadt    87:  *    may be used to endorse or promote products derived from this software
                     88:  *    without specific prior written permission.
1.21      lukem      89:  *
                     90:  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
1.1       deraadt    91:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     92:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.21      lukem      93:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
1.1       deraadt    94:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     95:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     96:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     97:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     98:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     99:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                    100:  * SUCH DAMAGE.
                    101:  */
                    102:
                    103: void   blkfree __P((char **));
1.5       lukem     104: char   *conffilename __P((const char *));
1.1       deraadt   105: char  **copyblk __P((char **));
1.22      lukem     106: void   count_users __P((void));
1.10      mycroft   107: void   cwd __P((const char *));
1.16      lukem     108: void   delete __P((const char *));
1.20      lukem     109: char  **do_conversion __P((const char *));
1.1       deraadt   110: void   dologout __P((int));
1.16      lukem     111: void   fatal __P((const char *));
1.21      lukem     112: int    format_file __P((const char *, int));
1.1       deraadt   113: int    ftpd_pclose __P((FILE *));
1.20      lukem     114: FILE   *ftpd_popen __P((char *[], const char *, int));
1.1       deraadt   115: char   *getline __P((char *, int, FILE *));
1.22      lukem     116: void   init_curclass __P((void));
1.16      lukem     117: void   logcmd __P((const char *, off_t, const char *, const char *,
                    118:            const struct timeval *, const char *));
1.9       mycroft   119: void   logwtmp __P((const char *, const char *, const char *));
1.1       deraadt   120: void   lreply __P((int, const char *, ...));
1.16      lukem     121: void   makedir __P((const char *));
1.4       christos  122: void   parse_conf __P((char *));
1.16      lukem     123: void   pass __P((const char *));
1.1       deraadt   124: void   passive __P((void));
1.19      itojun    125: void   long_passive __P((char *, int));
1.10      mycroft   126: void   perror_reply __P((int, const char *));
1.1       deraadt   127: void   pwd __P((void));
1.16      lukem     128: void   removedir __P((const char *));
                    129: void   renamecmd __P((const char *, const char *));
1.1       deraadt   130: char   *renamefrom __P((char *));
                    131: void   reply __P((int, const char *, ...));
1.20      lukem     132: void   retrieve __P((char *[], const char *));
1.16      lukem     133: void   send_file_list __P((const char *));
1.3       lukem     134: void   show_chdir_messages __P((int));
1.1       deraadt   135: void   statcmd __P((void));
1.16      lukem     136: void   statfilecmd __P((const char *));
                    137: void   store __P((const char *, const char *, int));
1.21      lukem     138: int    strsuftoi __P((const char *));
1.16      lukem     139: void   user __P((const char *));
1.12      lukem     140: char   *xstrdup __P((const char *));
1.1       deraadt   141: void   yyerror __P((char *));
1.18      ross      142:
                    143: typedef long long qdfmt_t;
                    144: typedef unsigned long long qufmt_t;
1.3       lukem     145:
1.21      lukem     146: typedef enum {
                    147:        CLASS_GUEST,
                    148:        CLASS_CHROOT,
                    149:        CLASS_REAL
                    150: } class_t;
1.3       lukem     151:
                    152: struct ftpconv {
                    153:        struct ftpconv  *next;
1.4       christos  154:        char            *suffix;        /* Suffix of requested name */
                    155:        char            *types;         /* Valid file types */
                    156:        char            *disable;       /* File to disable conversions */
                    157:        char            *command;       /* Command to do the conversion */
1.3       lukem     158: };
                    159:
                    160: struct ftpclass {
1.7       lukem     161:        int              checkportcmd;  /* Check PORT commands are valid */
1.4       christos  162:        char            *classname;     /* Current class */
1.20      lukem     163:        struct ftpconv  *conversions;   /* List of conversions */
1.4       christos  164:        char            *display;       /* Files to display upon chdir */
1.22      lukem     165:        int              limit;         /* Max connections (-1 = unlimited) */
                    166:        char            *limitfile;     /* File to display if limit reached */
1.21      lukem     167:        int              maxrateget;    /* Maximum get transfer rate throttle */
                    168:        int              maxrateput;    /* Maximum put transfer rate throttle */
1.3       lukem     169:        unsigned int     maxtimeout;    /* Maximum permitted timeout */
1.21      lukem     170:        int              modify;        /* Allow CHMOD, DELE, MKD, RMD, RNFR,
                    171:                                           UMASK */
                    172:        char            *motd;          /* MotD file to display after login */
1.4       christos  173:        char            *notify;        /* Files to notify about upon chdir */
1.23    ! lukem     174:        int              passive;       /* Allow PASV mode */
        !           175:        int              portmin;       /* Minumum port for passive mode */
        !           176:        int              portmax;       /* Maximum port for passive mode */
1.21      lukem     177:        int              rateget;       /* Get (RETR) transfer rate throttle */
                    178:        int              rateput;       /* Put (STOR) transfer rate throttle */
1.3       lukem     179:        unsigned int     timeout;       /* Default timeout */
1.21      lukem     180:        class_t          type;          /* Class type */
1.3       lukem     181:        mode_t           umask;         /* Umask to use */
1.21      lukem     182:        int              upload;        /* As per modify, but also allow
                    183:                                           APPE, STOR, STOU */
1.3       lukem     184: };
1.11      lukem     185:
1.19      itojun    186: #include <netinet/in.h>
                    187:
                    188: union sockunion {
                    189:        struct sockinet {
                    190:                u_char si_len;
                    191:                u_char si_family;
                    192:                u_short si_port;
                    193:        } su_si;
                    194:        struct sockaddr_in  su_sin;
                    195:        struct sockaddr_in6 su_sin6;
                    196: };
                    197: #define su_len         su_si.si_len
                    198: #define su_family      su_si.si_family
                    199: #define su_port                su_si.si_port
                    200:
1.23    ! lukem     201: extern  int            yyparse __P((void));
1.11      lukem     202:
1.23    ! lukem     203: #ifndef        GLOBAL
        !           204: #define        GLOBAL  extern
        !           205: #endif
        !           206:
        !           207: GLOBAL int             connections;
        !           208: GLOBAL struct ftpclass curclass;
        !           209: GLOBAL union sockunion data_dest;
        !           210: GLOBAL int             debug;
        !           211: GLOBAL jmp_buf         errcatch;
        !           212: GLOBAL int             form;
        !           213: GLOBAL int             hasyyerrored;
        !           214: GLOBAL union sockunion his_addr;
        !           215: GLOBAL char            hostname[];
1.11      lukem     216: #ifdef KERBEROS5
1.23    ! lukem     217: GLOBAL krb5_context    kcontext;
1.11      lukem     218: #endif
1.23    ! lukem     219: GLOBAL int             logged_in;
        !           220: GLOBAL int             logging;
        !           221: GLOBAL int             pdata;
        !           222: GLOBAL char            proctitle[];
        !           223: GLOBAL struct passwd  *pw;
        !           224: GLOBAL char            remotehost[];
        !           225: GLOBAL off_t           restart_point;
        !           226: GLOBAL char            tmpline[];
        !           227: GLOBAL sig_atomic_t    transflag;
        !           228: GLOBAL int             type;
        !           229: GLOBAL int             usedefault;
        !           230: GLOBAL const char      version[];
        !           231:
        !           232: GLOBAL off_t           total_data_in,  total_data_out,  total_data;
        !           233: GLOBAL off_t           total_files_in, total_files_out, total_files;
        !           234: GLOBAL off_t           total_bytes_in, total_bytes_out, total_bytes;
        !           235: GLOBAL off_t           total_xfers_in, total_xfers_out, total_xfers;
1.16      lukem     236:
                    237:
1.21      lukem     238: #define EMPTYSTR(p)    ((p) == NULL || *(p) == '\0')
                    239: #define NEXTWORD(P, W) do { \
                    240:                                (W) = strsep(&(P), " \t"); \
                    241:                        } while ((W) != NULL && *(W) == '\0')
1.16      lukem     242: #define PLURAL(s)      ((s) == 1 ? "" : "s")
1.21      lukem     243: #define REASSIGN(X,Y)  do { if (X) free(X); (X)=(Y); } while (0)
                    244:
1.17      lukem     245: #define        INTERNAL_LS     "/bin/ls"

CVSweb <webmaster@jp.NetBSD.org>