Hi,

The following diff adds some missing consts for char * to the internal
program functions.

OK?

bye,
Jan

Index: extern.h
===================================================================
RCS file: /cvs/src/libexec/ftpd/extern.h,v
retrieving revision 1.21
diff -u -p -r1.21 extern.h
--- extern.h    15 Jan 2020 22:06:59 -0000      1.21
+++ extern.h    4 May 2021 08:34:14 -0000
@@ -64,38 +64,38 @@
 void   blkfree(char **);
 char  **copyblk(char **);
 void   cwd(char *);
-void   delete(char *);
+void   delete(const char *);
 void   dologout(int);
-void   fatal(char *);
+void   fatal(const char *);
 int    ftpd_pclose(FILE *, pid_t);
 FILE   *ftpd_ls(const char *, pid_t *);
 int     get_line(char *, int, FILE *);
-void   ftpdlogwtmp(char *, char *, char *);
+void   ftpdlogwtmp(const char *, const char *, const char *);
 void   lreply(int, const char *, ...);
-void   makedir(char *);
-void   nack(char *);
+void   makedir(const char *);
+void   nack(const char *);
 enum auth_ret
        pass(char *);
 void   passive(void);
 int    epsvproto2af(int);
 int    af2epsvproto(int);
-void   long_passive(char *, int);
+void   long_passive(const char *, int);
 int    extended_port(const char *);
 void   epsv_protounsupp(const char *);
-void   perror_reply(int, char *);
+void   perror_reply(int, const char *);
 void   pwd(void);
-void   removedir(char *);
-void   renamecmd(char *, char *);
+void   removedir(const char *);
+void   renamecmd(const char *, const char *);
 char   *renamefrom(char *);
 void   reply(int, const char *, ...);
 void   reply_r(int, const char *, ...);
 enum ret_cmd { RET_FILE, RET_LIST };
-void   retrieve(enum ret_cmd, char *);
+void   retrieve(enum ret_cmd, const char *);
 void   send_file_list(char *);
 void   setproctitle(const char *, ...);
 void   statcmd(void);
-void   statfilecmd(char *);
-void   store(char *, char *, int);
+void   statfilecmd(const char *);
+void   store(const char *, const char *, int);
 void   upper(char *);
 void   user(char *);
 void   yyerror(char *);
Index: ftpcmd.y
===================================================================
RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v
retrieving revision 1.69
diff -u -p -r1.69 ftpcmd.y
--- ftpcmd.y    4 Mar 2020 20:17:48 -0000       1.69
+++ ftpcmd.y    4 May 2021 08:34:14 -0000
@@ -1065,8 +1065,8 @@ struct tab sitetab[] = {
 
 static void     help(struct tab *, char *);
 static struct tab *
-                lookup(struct tab *, char *);
-static void     sizecmd(char *);
+                lookup(struct tab *, const char *);
+static void     sizecmd(const char *);
 static int      yylex(void);
 
 extern int epsvall;
@@ -1074,7 +1074,7 @@ extern int epsvall;
 static struct tab *
 lookup(p, cmd)
        struct tab *p;
-       char *cmd;
+       const char *cmd;
 {
 
        for (; p->name != NULL; p++)
@@ -1508,7 +1506,7 @@ help(ctab, s)
 
 static void
 sizecmd(filename)
-       char *filename;
+       const char *filename;
 {
        switch (type) {
        case TYPE_L:
Index: ftpd.c
===================================================================
RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.229
diff -u -p -r1.229 ftpd.c
--- ftpd.c      15 Jan 2020 22:06:59 -0000      1.229
+++ ftpd.c      4 May 2021 08:34:14 -0000
@@ -191,28 +191,28 @@ char      proctitle[BUFSIZ];      /* initial part 
                        (long long)(cnt)); \
        }
 
-static void     ack(char *);
+static void     ack(const char *);
 static void     sigurg(int);
 static void     myoob(void);
-static int      checkuser(char *, char *);
-static FILE    *dataconn(char *, off_t, char *);
+static int      checkuser(char *, const char *);
+static FILE    *dataconn(const char *, off_t, char *);
 static void     dolog(struct sockaddr *);
 static char    *copy_dir(char *, struct passwd *);
 static char    *curdir(void);
 static void     end_login(void);
 static FILE    *getdatasock(char *);
-static int      guniquefd(char *, char **);
+static int      guniquefd(const char *, char **);
 static void     lostconn(int);
 static void     sigquit(int);
 static int      receive_data(FILE *, FILE *);
 static void     replydirname(const char *, const char *);
 static int      send_data(FILE *, FILE *, off_t, off_t, int);
 static struct passwd *
-                sgetpwnam(char *, struct passwd *);
+                sgetpwnam(const char *, struct passwd *);
 static void     reapchild(int);
 static void     usage(void);
 
-void    logxfer(char *, off_t, time_t);
+void    logxfer(const char *, off_t, time_t);
 void    set_slave_signals(void);
 
 static char *
@@ -638,7 +638,7 @@ sigquit(int signo)
  * (e.g., globbing).
  */
 static struct passwd *
-sgetpwnam(char *name, struct passwd *pw)
+sgetpwnam(const char *name, struct passwd *pw)
 {
        static struct passwd *save;
        struct passwd *old;
@@ -819,7 +819,7 @@ user(char *name)
  * Check if a user is in the file "fname"
  */
 static int
-checkuser(char *fname, char *name)
+checkuser(char *fname, const char *name)
 {
        FILE *fp;
        int found = 0;
@@ -1113,7 +1113,7 @@ bad:
 }
 
 void
-retrieve(enum ret_cmd cmd, char *name)
+retrieve(enum ret_cmd cmd, const char *name)
 {
        FILE *fin, *dout;
        struct stat st;
@@ -1189,7 +1189,7 @@ done:
 }
 
 void
-store(char *name, char *mode, int unique)
+store(const char *name, const char *mode, int unique)
 {
        FILE *fout, *din;
        int (*closefunc)(FILE *);
@@ -1335,7 +1335,7 @@ bad:
 }
 
 static FILE *
-dataconn(char *name, off_t size, char *mode)
+dataconn(const char *name, off_t size, char *mode)
 {
        char sizebuf[32];
        FILE *file = NULL;
@@ -1724,7 +1724,7 @@ got_oob:
 }
 
 void
-statfilecmd(char *filename)
+statfilecmd(const char *filename)
 {
        FILE *fin;
        int c;
@@ -1885,7 +1885,7 @@ printaddr:
 }
 
 void
-fatal(char *s)
+fatal(const char *s)
 {
 
        reply(451, "Error in server: %s", s);
@@ -1968,14 +1968,14 @@ lreply(int n, const char *fmt, ...)
 }
 
 static void
-ack(char *s)
+ack(const char *s)
 {
 
        reply(250, "%s command successful.", s);
 }
 
 void
-nack(char *s)
+nack(const char *s)
 {
 
        reply(502, "%s command not implemented.", s);
@@ -1990,7 +1990,7 @@ yyerror(char *s)
 }
 
 void
-delete(char *name)
+delete(const char *name)
 {
        struct stat st;
 
@@ -2061,7 +2061,7 @@ replydirname(const char *name, const cha
 }
 
 void
-makedir(char *name)
+makedir(const char *name)
 {
 
        LOGCMD("mkdir", name);
@@ -2072,7 +2072,7 @@ makedir(char *name)
 }
 
 void
-removedir(char *name)
+removedir(const char *name)
 {
 
        LOGCMD("rmdir", name);
@@ -2107,7 +2107,7 @@ renamefrom(char *name)
 }
 
 void
-renamecmd(char *from, char *to)
+renamecmd(const char *from, const char *to)
 {
 
        LOGCMD2("rename", from, to);
@@ -2299,7 +2299,7 @@ af2epsvproto(int af)
  * 229 Entering Extended Passive Mode (|||port|)
  */
 void
-long_passive(char *cmd, int pf)
+long_passive(const char *cmd, int pf)
 {
        socklen_t len;
        int on = 1;
@@ -2534,7 +2534,7 @@ epsv_protounsupp(const char *message)
  * Generates failure reply on error.
  */
 static int
-guniquefd(char *local, char **nam)
+guniquefd(const char *local, char **nam)
 {
        static char new[PATH_MAX];
        struct stat st;
@@ -2573,7 +2573,7 @@ guniquefd(char *local, char **nam)
  * Format and send reply containing system error number.
  */
 void
-perror_reply(int code, char *string)
+perror_reply(int code, const char *string)
 {
 
        reply(code, "%s: %s.", string, strerror(errno));
@@ -2737,7 +2737,7 @@ reapchild(int signo)
 }
 
 void
-logxfer(char *name, off_t size, time_t start)
+logxfer(const char *name, off_t size, time_t start)
 {
        char buf[400 + (HOST_NAME_MAX+1)*4 + PATH_MAX*4];
        char dir[PATH_MAX], path[PATH_MAX], rpath[PATH_MAX];
Index: logwtmp.c
===================================================================
RCS file: /cvs/src/libexec/ftpd/logwtmp.c,v
retrieving revision 1.12
diff -u -p -r1.12 logwtmp.c
--- logwtmp.c   28 Jun 2019 13:32:53 -0000      1.12
+++ logwtmp.c   4 May 2021 08:34:14 -0000
@@ -54,7 +54,7 @@ static int fd = -1;
  * after login, but before logout).
  */
 void
-ftpdlogwtmp(char *line, char *name, char *host)
+ftpdlogwtmp(const char *line, const char *name, const char *host)
 {
        struct timeval tv;
        struct stat buf;

Reply via email to