Hello there,

Is there any good reason why most of .c files need to have externs for
ServerOptions/Options? Any reason not to have them in appropriate header
files?

Index: auth-chall.c
===================================================================
RCS file: /cvs/openssh/auth-chall.c,v
retrieving revision 1.19
diff -p -n -r1.19 auth-chall.c
*** auth-chall.c        1 Sep 2006 05:38:36 -0000       1.19
--- auth-chall.c        7 Dec 2011 00:21:08 -0000
***************
*** 40,46 ****
  
  extern KbdintDevice *devices[];
  static KbdintDevice *device;
- extern ServerOptions options;
  
  char *
  get_challenge(Authctxt *authctxt)
--- 40,45 ----
Index: auth-krb5.c
===================================================================
RCS file: /cvs/openssh/auth-krb5.c,v
retrieving revision 1.36
diff -p -n -r1.36 auth-krb5.c
*** auth-krb5.c 20 Dec 2009 23:49:22 -0000      1.36
--- auth-krb5.c 7 Dec 2011 00:21:08 -0000
***************
*** 52,59 ****
  #include <string.h>
  #include <krb5.h>
  
- extern ServerOptions   options;
- 
  static int
  krb5_init(void *context)
  {
--- 52,57 ----
Index: auth-options.c
===================================================================
RCS file: /cvs/openssh/auth-options.c,v
retrieving revision 1.55
diff -p -n -r1.55 auth-options.c
*** auth-options.c      18 Oct 2011 05:06:14 -0000      1.55
--- auth-options.c      7 Dec 2011 00:21:09 -0000
*************** int forced_tun_device = -1;
*** 58,65 ****
  /* "principals=" option. */
  char *authorized_principals = NULL;
  
- extern ServerOptions options;
- 
  void
  auth_clear_options(void)
  {
--- 58,63 ----
Index: auth-pam.c
===================================================================
RCS file: /cvs/openssh/auth-pam.c,v
retrieving revision 1.146
diff -p -n -r1.146 auth-pam.c
*** auth-pam.c  12 Jul 2009 12:07:21 -0000      1.146
--- auth-pam.c  7 Dec 2011 00:21:09 -0000
***************
*** 98,104 ****
  #endif
  #include "monitor_wrap.h"
  
- extern ServerOptions options;
  extern Buffer loginmsg;
  extern int compat20;
  extern u_int utmp_len;
--- 98,103 ----
Index: auth-passwd.c
===================================================================
RCS file: /cvs/openssh/auth-passwd.c,v
retrieving revision 1.90
diff -p -n -r1.90 auth-passwd.c
*** auth-passwd.c       8 Mar 2009 00:40:28 -0000       1.90
--- auth-passwd.c       7 Dec 2011 00:21:09 -0000
***************
*** 55,61 ****
  #include "auth-options.h"
  
  extern Buffer loginmsg;
- extern ServerOptions options;
  
  #ifdef HAVE_LOGIN_CAP
  extern login_cap_t *lc;
--- 55,60 ----
Index: auth-rh-rsa.c
===================================================================
RCS file: /cvs/openssh/auth-rh-rsa.c,v
retrieving revision 1.40
diff -p -n -r1.40 auth-rh-rsa.c
*** auth-rh-rsa.c       4 Mar 2010 10:53:35 -0000       1.40
--- auth-rh-rsa.c       7 Dec 2011 00:21:09 -0000
***************
*** 35,43 ****
  #endif
  #include "monitor_wrap.h"
  
- /* import */
- extern ServerOptions options;
- 
  int
  auth_rhosts_rsa_key_allowed(struct passwd *pw, char *cuser, char *chost,
      Key *client_host_key)
--- 35,40 ----
Index: auth-rhosts.c
===================================================================
RCS file: /cvs/openssh/auth-rhosts.c,v
retrieving revision 1.39
diff -p -n -r1.39 auth-rhosts.c
*** auth-rhosts.c       7 Mar 2010 12:05:17 -0000       1.39
--- auth-rhosts.c       7 Dec 2011 00:21:09 -0000
***************
*** 42,48 ****
  #include "misc.h"
  
  /* import */
- extern ServerOptions options;
  extern int use_privsep;
  
  /*
--- 42,47 ----
Index: auth-rsa.c
===================================================================
RCS file: /cvs/openssh/auth-rsa.c,v
retrieving revision 1.73
diff -p -n -r1.73 auth-rsa.c
*** auth-rsa.c  29 May 2011 11:39:38 -0000      1.73
--- auth-rsa.c  7 Dec 2011 00:21:09 -0000
***************
*** 48,56 ****
  #include "ssh.h"
  #include "misc.h"
  
- /* import */
- extern ServerOptions options;
- 
  /*
   * Session identifier that is used to bind key exchange and authentication
   * responses to a particular session.
--- 48,53 ----
Index: auth-sia.c
===================================================================
RCS file: /cvs/openssh/auth-sia.c,v
retrieving revision 1.20
diff -p -n -r1.20 auth-sia.c
*** auth-sia.c  28 Aug 2009 00:16:44 -0000      1.20
--- auth-sia.c  7 Dec 2011 00:21:09 -0000
***************
*** 45,51 ****
  #include "canohost.h"
  #include "uidswap.h"
  
- extern ServerOptions options;
  extern int saved_argc;
  extern char **saved_argv;
  
--- 45,50 ----
Index: auth.c
===================================================================
RCS file: /cvs/openssh/auth.c,v
retrieving revision 1.149
diff -p -n -r1.149 auth.c
*** auth.c      29 May 2011 11:40:42 -0000      1.149
--- auth.c      7 Dec 2011 00:21:09 -0000
***************
*** 73,79 ****
  #include "monitor_wrap.h"
  
  /* import */
- extern ServerOptions options;
  extern int use_privsep;
  extern Buffer loginmsg;
  extern struct passwd *privsep_pw;
--- 73,78 ----
Index: auth1.c
===================================================================
RCS file: /cvs/openssh/auth1.c,v
retrieving revision 1.127
diff -p -n -r1.127 auth1.c
*** auth1.c     31 Aug 2010 12:36:39 -0000      1.127
--- auth1.c     7 Dec 2011 00:21:09 -0000
***************
*** 42,48 ****
  #include "buffer.h"
  
  /* import */
- extern ServerOptions options;
  extern Buffer loginmsg;
  
  static int auth1_process_password(Authctxt *, char *, size_t);
--- 42,47 ----
Index: auth2-chall.c
===================================================================
RCS file: /cvs/openssh/auth2-chall.c,v
retrieving revision 1.38
diff -p -n -r1.38 auth2-chall.c
*** auth2-chall.c       28 Jan 2009 05:13:39 -0000      1.38
--- auth2-chall.c       7 Dec 2011 00:21:09 -0000
***************
*** 43,51 ****
  #include "log.h"
  #include "servconf.h"
  
- /* import */
- extern ServerOptions options;
- 
  static int auth2_challenge_start(Authctxt *);
  static int send_userauth_info_request(Authctxt *);
  static void input_userauth_info_response(int, u_int32_t, void *);
--- 43,48 ----
Index: auth2-gss.c
===================================================================
RCS file: /cvs/openssh/auth2-gss.c,v
retrieving revision 1.20
diff -p -n -r1.20 auth2-gss.c
*** auth2-gss.c 5 May 2011 04:04:11 -0000       1.20
--- auth2-gss.c 7 Dec 2011 00:21:09 -0000
***************
*** 45,52 ****
  #include "ssh-gss.h"
  #include "monitor_wrap.h"
  
- extern ServerOptions options;
- 
  static void input_gssapi_token(int type, u_int32_t plen, void *ctxt);
  static void input_gssapi_mic(int type, u_int32_t plen, void *ctxt);
  static void input_gssapi_exchange_complete(int type, u_int32_t plen, void 
*ctxt);
--- 45,50 ----
Index: auth2-hostbased.c
===================================================================
RCS file: /cvs/openssh/auth2-hostbased.c,v
retrieving revision 1.14
diff -p -n -r1.14 auth2-hostbased.c
*** auth2-hostbased.c   5 Aug 2010 03:04:50 -0000       1.14
--- auth2-hostbased.c   7 Dec 2011 00:21:09 -0000
***************
*** 49,55 ****
  #include "pathnames.h"
  
  /* import */
- extern ServerOptions options;
  extern u_char *session_id2;
  extern u_int session_id2_len;
  
--- 49,54 ----
Index: auth2-jpake.c
===================================================================
RCS file: /cvs/openssh/auth2-jpake.c,v
retrieving revision 1.5
diff -p -n -r1.5 auth2-jpake.c
*** auth2-jpake.c       31 Aug 2010 12:41:14 -0000      1.5
--- auth2-jpake.c       7 Dec 2011 00:21:10 -0000
*************** static void input_userauth_jpake_client_
*** 71,77 ****
  static int auth2_jpake_start(Authctxt *);
  
  /* import */
- extern ServerOptions options;
  extern u_char *session_id2;
  extern u_int session_id2_len;
  
--- 71,76 ----
Index: auth2-kbdint.c
===================================================================
RCS file: /cvs/openssh/auth2-kbdint.c,v
retrieving revision 1.8
diff -p -n -r1.8 auth2-kbdint.c
*** auth2-kbdint.c      8 Mar 2009 00:40:28 -0000       1.8
--- auth2-kbdint.c      7 Dec 2011 00:21:10 -0000
***************
*** 38,46 ****
  #include "buffer.h"
  #include "servconf.h"
  
- /* import */
- extern ServerOptions options;
- 
  static int
  userauth_kbdint(Authctxt *authctxt)
  {
--- 38,43 ----
Index: auth2-none.c
===================================================================
RCS file: /cvs/openssh/auth2-none.c,v
retrieving revision 1.21
diff -p -n -r1.21 auth2-none.c
*** auth2-none.c        26 Jun 2010 00:01:33 -0000      1.21
--- auth2-none.c        7 Dec 2011 00:21:10 -0000
***************
*** 50,58 ****
  #endif
  #include "monitor_wrap.h"
  
- /* import */
- extern ServerOptions options;
- 
  /* "none" is allowed only one time */
  static int none_enabled = 1;
  
--- 50,55 ----
Index: auth2-passwd.c
===================================================================
RCS file: /cvs/openssh/auth2-passwd.c,v
retrieving revision 1.12
diff -p -n -r1.12 auth2-passwd.c
*** auth2-passwd.c      8 Mar 2009 00:40:28 -0000       1.12
--- auth2-passwd.c      7 Dec 2011 00:21:10 -0000
***************
*** 43,51 ****
  #include "monitor_wrap.h"
  #include "servconf.h"
  
- /* import */
- extern ServerOptions options;
- 
  static int
  userauth_passwd(Authctxt *authctxt)
  {
--- 43,48 ----
Index: auth2-pubkey.c
===================================================================
RCS file: /cvs/openssh/auth2-pubkey.c,v
retrieving revision 1.32
diff -p -n -r1.32 auth2-pubkey.c
*** auth2-pubkey.c      2 Oct 2011 08:00:00 -0000       1.32
--- auth2-pubkey.c      7 Dec 2011 00:21:10 -0000
***************
*** 60,66 ****
  #include "match.h"
  
  /* import */
- extern ServerOptions options;
  extern u_char *session_id2;
  extern u_int session_id2_len;
  
--- 60,65 ----
Index: auth2.c
===================================================================
RCS file: /cvs/openssh/auth2.c,v
retrieving revision 1.153
diff -p -n -r1.153 auth2.c
*** auth2.c     5 May 2011 04:04:11 -0000       1.153
--- auth2.c     7 Dec 2011 00:21:10 -0000
***************
*** 56,62 ****
  #include "monitor_wrap.h"
  
  /* import */
- extern ServerOptions options;
  extern u_char *session_id2;
  extern u_int session_id2_len;
  extern Buffer loginmsg;
--- 56,61 ----
Index: clientloop.c
===================================================================
RCS file: /cvs/openssh/clientloop.c,v
retrieving revision 1.226
diff -p -n -r1.226 clientloop.c
*** clientloop.c        22 Sep 2011 11:39:49 -0000      1.226
--- clientloop.c        7 Dec 2011 00:21:10 -0000
***************
*** 111,119 ****
  #include "msg.h"
  #include "roaming.h"
  
- /* import options */
- extern Options options;
- 
  /* Flag indicating that stdin should be redirected from /dev/null. */
  extern int stdin_null_flag;
  
--- 111,116 ----
Index: gss-serv-krb5.c
===================================================================
RCS file: /cvs/openssh/gss-serv-krb5.c,v
retrieving revision 1.17
diff -p -n -r1.17 gss-serv-krb5.c
*** gss-serv-krb5.c     1 Sep 2006 05:38:36 -0000       1.17
--- gss-serv-krb5.c     7 Dec 2011 00:21:10 -0000
***************
*** 44,51 ****
  #include "buffer.h"
  #include "ssh-gss.h"
  
- extern ServerOptions options;
- 
  #ifdef HEIMDAL
  # include <krb5.h>
  #else
--- 44,49 ----
Index: monitor.c
===================================================================
RCS file: /cvs/openssh/monitor.c,v
retrieving revision 1.150
diff -p -n -r1.150 monitor.c
*** monitor.c   5 Aug 2011 20:15:18 -0000       1.150
--- monitor.c   7 Dec 2011 00:21:10 -0000
*************** static Gssctxt *gsscontext = NULL;
*** 103,109 ****
  #endif
  
  /* Imports */
- extern ServerOptions options;
  extern u_int utmp_len;
  extern Newkeys *current_keys[];
  extern z_stream incoming_stream;
--- 103,108 ----
Index: monitor_wrap.c
===================================================================
RCS file: /cvs/openssh/monitor_wrap.c,v
retrieving revision 1.89
diff -p -n -r1.89 monitor_wrap.c
*** monitor_wrap.c      20 Jun 2011 04:42:23 -0000      1.89
--- monitor_wrap.c      7 Dec 2011 00:21:10 -0000
*************** extern z_stream incoming_stream;
*** 86,92 ****
  extern z_stream outgoing_stream;
  extern struct monitor *pmonitor;
  extern Buffer loginmsg;
- extern ServerOptions options;
  
  void
  mm_log_handler(LogLevel level, const char *msg, void *ctx)
--- 86,91 ----
Index: mux.c
===================================================================
RCS file: /cvs/openssh/mux.c,v
retrieving revision 1.33
diff -p -n -r1.33 mux.c
*** mux.c       2 Oct 2011 07:59:03 -0000       1.33
--- mux.c       7 Dec 2011 00:21:10 -0000
***************
*** 87,93 ****
  
  /* from ssh.c */
  extern int tty_flag;
- extern Options options;
  extern int stdin_null_flag;
  extern char *host;
  extern int subsystem_flag;
--- 87,92 ----
Index: platform.c
===================================================================
RCS file: /cvs/openssh/platform.c,v
retrieving revision 1.18
diff -p -n -r1.18 platform.c
*** platform.c  11 Jan 2011 06:02:25 -0000      1.18
--- platform.c  7 Dec 2011 00:21:10 -0000
***************
*** 35,41 ****
  #include "openbsd-compat/openbsd-compat.h"
  
  extern int use_privsep;
- extern ServerOptions options;
  
  void
  platform_pre_listen(void)
--- 35,40 ----
Index: readconf.h
===================================================================
RCS file: /cvs/openssh/readconf.h,v
retrieving revision 1.83
diff -p -n -r1.83 readconf.h
*** readconf.h  2 Oct 2011 07:59:03 -0000       1.83
--- readconf.h  7 Dec 2011 00:21:10 -0000
*************** typedef struct {
*** 137,142 ****
--- 137,144 ----
        int     request_tty;
  }       Options;
  
+ extern Options options;
+ 
  #define SSHCTL_MASTER_NO      0
  #define SSHCTL_MASTER_YES     1
  #define SSHCTL_MASTER_AUTO    2
Index: roaming_client.c
===================================================================
RCS file: /cvs/openssh/roaming_client.c,v
retrieving revision 1.6
diff -p -n -r1.6 roaming_client.c
*** roaming_client.c    26 Jan 2010 01:53:06 -0000      1.6
--- roaming_client.c    7 Dec 2011 00:21:10 -0000
***************
*** 50,56 ****
  #include "sshconnect.h"
  
  /* import */
- extern Options options;
  extern char *host;
  extern struct sockaddr_storage hostaddr;
  extern int session_resumed;
--- 50,55 ----
Index: servconf.h
===================================================================
RCS file: /cvs/openssh/servconf.h,v
retrieving revision 1.91
diff -p -n -r1.91 servconf.h
*** servconf.h  22 Jun 2011 22:30:03 -0000      1.91
--- servconf.h  7 Dec 2011 00:21:10 -0000
*************** typedef struct {
*** 168,173 ****
--- 168,175 ----
        char   *authorized_principals_file;
  }       ServerOptions;
  
+ extern ServerOptions options;
+ 
  /*
   * These are string config options that must be copied between the
   * Match sub-config and the main config, and must be sent from the
Index: serverloop.c
===================================================================
RCS file: /cvs/openssh/serverloop.c,v
retrieving revision 1.169
diff -p -n -r1.169 serverloop.c
*** serverloop.c        20 May 2011 09:02:50 -0000      1.169
--- serverloop.c        7 Dec 2011 00:21:10 -0000
***************
*** 80,87 ****
  #include "misc.h"
  #include "roaming.h"
  
- extern ServerOptions options;
- 
  /* XXX */
  extern Kex *xxx_kex;
  extern Authctxt *the_authctxt;
--- 80,85 ----
Index: session.c
===================================================================
RCS file: /cvs/openssh/session.c,v
retrieving revision 1.413
diff -p -n -r1.413 session.c
*** session.c   3 Nov 2011 23:55:24 -0000       1.413
--- session.c   7 Dec 2011 00:21:11 -0000
*************** static void do_authenticated2(Authctxt *
*** 130,136 ****
  static int session_pty_req(Session *);
  
  /* import */
- extern ServerOptions options;
  extern char *__progname;
  extern int log_stderr;
  extern int debug_flag;
--- 130,135 ----
Index: sshconnect.c
===================================================================
RCS file: /cvs/openssh/sshconnect.c,v
retrieving revision 1.207
diff -p -n -r1.207 sshconnect.c
*** sshconnect.c        29 May 2011 11:42:34 -0000      1.207
--- sshconnect.c        7 Dec 2011 00:21:11 -0000
*************** static int matching_host_key_dns = 0;
*** 70,76 ****
  static pid_t proxy_command_pid = 0;
  
  /* import */
- extern Options options;
  extern char *__progname;
  extern uid_t original_real_uid;
  extern uid_t original_effective_uid;
--- 70,75 ----
Index: sshconnect1.c
===================================================================
RCS file: /cvs/openssh/sshconnect1.c,v
retrieving revision 1.72
diff -p -n -r1.72 sshconnect1.c
*** sshconnect1.c       7 Nov 2006 12:14:42 -0000       1.72
--- sshconnect1.c       7 Dec 2011 00:21:11 -0000
***************
*** 52,58 ****
  u_char session_id[16];
  u_int supported_authentications = 0;
  
- extern Options options;
  extern char *__progname;
  
  /*
--- 52,57 ----
Index: sshconnect2.c
===================================================================
RCS file: /cvs/openssh/sshconnect2.c,v
retrieving revision 1.180
diff -p -n -r1.180 sshconnect2.c
*** sshconnect2.c       29 May 2011 11:42:34 -0000      1.180
--- sshconnect2.c       7 Dec 2011 00:21:11 -0000
***************
*** 80,86 ****
  /* import */
  extern char *client_version_string;
  extern char *server_version_string;
- extern Options options;
  
  /*
   * SSH2 key exchange
--- 80,85 ----
Index: sshlogin.c
===================================================================
RCS file: /cvs/openssh/sshlogin.c,v
retrieving revision 1.36
diff -p -n -r1.36 sshlogin.c
*** sshlogin.c  11 Jan 2011 06:20:07 -0000      1.36
--- sshlogin.c  7 Dec 2011 00:21:11 -0000
***************
*** 61,67 ****
  #include "servconf.h"
  
  extern Buffer loginmsg;
- extern ServerOptions options;
  
  /*
   * Returns the time when the user last logged in.  Returns 0 if the
--- 61,66 ----
Index: openbsd-compat/bsd-cray.c
===================================================================
RCS file: /cvs/openssh/openbsd-compat/bsd-cray.c,v
retrieving revision 1.17
diff -p -n -r1.17 bsd-cray.c
*** openbsd-compat/bsd-cray.c   15 Aug 2007 09:17:43 -0000      1.17
--- openbsd-compat/bsd-cray.c   7 Dec 2011 00:21:11 -0000
***************
*** 90,97 ****
  
  #define MAXACID 80
  
- extern ServerOptions options;
- 
  char cray_tmpdir[TPATHSIZ + 1];                   /* job TMPDIR path */
  
  struct sysv sysv;     /* system security structure */
--- 90,95 ----

Reply via email to