Re: ftpd(8): constify internal functions

2021-05-21 Thread Jan Klemkow
ping?

On Thu, May 13, 2021 at 04:44:56PM +0200, Jan Klemkow wrote:
> ping?
> 
> On Tue, May 04, 2021 at 10:50:50AM +0200, Jan Klemkow wrote:
> > 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.h15 Jan 2020 22:06:59 -  1.21
> > +++ extern.h4 May 2021 08:34:14 -
> > @@ -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 *);
> >  intftpd_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);
> >  intepsvproto2af(int);
> >  intaf2epsvproto(int);
> > -void   long_passive(char *, int);
> > +void   long_passive(const char *, int);
> >  intextended_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.y4 Mar 2020 20:17:48 -   1.69
> > +++ ftpcmd.y4 May 2021 08:34:14 -
> > @@ -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 -  1.229
> > +++ ftpd.c  4 May 2021 08:34:14 -
> > @@ -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

Re: ftpd(8): constify internal functions

2021-05-13 Thread Jan Klemkow
ping?

On Tue, May 04, 2021 at 10:50:50AM +0200, Jan Klemkow wrote:
> 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 -  1.21
> +++ extern.h  4 May 2021 08:34:14 -
> @@ -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 -   1.69
> +++ ftpcmd.y  4 May 2021 08:34:14 -
> @@ -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 intyylex(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.c15 Jan 2020 22:06:59 -  1.229
> +++ ftpd.c4 May 2021 08:34:14 -
> @@ -191,28 +191,28 @@ charproctitle[BUFSIZ];  /* initial part 
>   (long long)(cnt)); \
>   }
>  
> -static void   ack(char *);
> +static void   ack(const char *);
>  static void   sigurg(int);
>  static void   myoob(void);
> -static intcheckuser(char *, char *);
> -static FILE  *dataconn(char *, off_t, char *);
> +static intcheckuser(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 intguniquefd(char *, char **);
> +static intguniquefd(const char *, char **);
>  static void   lostconn(int);
>  static void   sigquit(int);
>  static intreceive_data(FILE *, FILE *);
>  static void   replydirname(const char *, const char *);
>  static intsend_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 *s

ftpd(8): constify internal functions

2021-05-04 Thread Jan Klemkow
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.h15 Jan 2020 22:06:59 -  1.21
+++ extern.h4 May 2021 08:34:14 -
@@ -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 *);
 intftpd_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);
 intepsvproto2af(int);
 intaf2epsvproto(int);
-void   long_passive(char *, int);
+void   long_passive(const char *, int);
 intextended_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.y4 Mar 2020 20:17:48 -   1.69
+++ ftpcmd.y4 May 2021 08:34:14 -
@@ -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 -  1.229
+++ ftpd.c  4 May 2021 08:34:14 -
@@ -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);
 
-voidlogxfer(char *, off_t, time_t);
+voidlogxfer(const char *, off_t, time_t);
 voidset_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 *fna