@@ -294,6 +294,11 @@ static struct {
294294 { NULL , oBadOption }
295295};
296296
297+ #ifdef WIN32_FIXME
298+ char user_hostfile_name [MAX_PATH ] ; // full path of "known_hosts"
299+ char user_hostfile_name2 [MAX_PATH ] ; // full path of "known_hosts2"
300+ #endif
301+
297302/*
298303 * Adds a local TCP/IP port forward to options. Never returns if there is an
299304 * error.
@@ -379,7 +384,7 @@ clear_forwardings(Options *options)
379384
380385void
381386add_identity_file (Options * options , const char * dir , const char * filename ,
382- int userprovided )
387+ int userprovided , struct passwd * pw )
383388{
384389 char * path ;
385390 int i ;
@@ -391,7 +396,12 @@ add_identity_file(Options *options, const char *dir, const char *filename,
391396 if (dir == NULL ) /* no dir, filename is absolute */
392397 path = xstrdup (filename );
393398 else
399+ #ifndef WIN32_FIXME
394400 (void )xasprintf (& path , "%.100s%.100s" , dir , filename );
401+ #else
402+ if ( strcmp (dir , "~/" ) == 0 )
403+ (void )xasprintf (& path , "%.100s\\%.100s" , pw -> pw_dir , filename );
404+ #endif
395405
396406 /* Avoid registering duplicates */
397407 for (i = 0 ; i < options -> num_identity_files ; i ++ ) {
@@ -995,7 +1005,7 @@ process_config_line(Options *options, struct passwd *pw, const char *host,
9951005 fatal ("%.200s line %d: Too many identity files specified (max %d)." ,
9961006 filename , linenum , SSH_MAX_IDENTITY_FILES );
9971007 add_identity_file (options , NULL ,
998- arg , flags & SSHCONF_USERCONF );
1008+ arg , flags & SSHCONF_USERCONF , pw );
9991009 }
10001010 break ;
10011011
@@ -1748,9 +1758,18 @@ fill_default_options_for_canonicalization(Options *options)
17481758 * Called after processing other sources of option data, this fills those
17491759 * options for which no value has been specified with their default values.
17501760 */
1761+ #ifndef WIN32_FIXME
17511762void
17521763fill_default_options (Options * options )
1764+ #else
1765+ void fill_default_options (Options * options , struct passwd * pw )
1766+ #endif
17531767{
1768+ #ifdef WIN32_FIXME
1769+ sprintf (user_hostfile_name ,"%s\\%s\\known_hosts" , pw -> pw_dir , _PATH_SSH_USER_DIR );// SSH_USER_HOSTFILE2;
1770+ sprintf (user_hostfile_name2 ,"%s\\%s\\known_hosts2" , pw -> pw_dir , _PATH_SSH_USER_DIR );// SSH_USER_HOSTFILE2;
1771+ #endif
1772+
17541773 if (options -> forward_agent == -1 )
17551774 options -> forward_agent = 0 ;
17561775 if (options -> forward_x11 == -1 )
@@ -1818,19 +1837,19 @@ fill_default_options(Options * options)
18181837 if (options -> num_identity_files == 0 ) {
18191838 if (options -> protocol & SSH_PROTO_1 ) {
18201839 add_identity_file (options , "~/" ,
1821- _PATH_SSH_CLIENT_IDENTITY , 0 );
1840+ _PATH_SSH_CLIENT_IDENTITY , 0 , pw );
18221841 }
18231842 if (options -> protocol & SSH_PROTO_2 ) {
18241843 add_identity_file (options , "~/" ,
1825- _PATH_SSH_CLIENT_ID_RSA , 0 );
1844+ _PATH_SSH_CLIENT_ID_RSA , 0 , pw );
18261845 add_identity_file (options , "~/" ,
1827- _PATH_SSH_CLIENT_ID_DSA , 0 );
1846+ _PATH_SSH_CLIENT_ID_DSA , 0 , pw );
18281847#ifdef OPENSSL_HAS_ECC
18291848 add_identity_file (options , "~/" ,
1830- _PATH_SSH_CLIENT_ID_ECDSA , 0 );
1849+ _PATH_SSH_CLIENT_ID_ECDSA , 0 , pw );
18311850#endif
18321851 add_identity_file (options , "~/" ,
1833- _PATH_SSH_CLIENT_ID_ED25519 , 0 );
1852+ _PATH_SSH_CLIENT_ID_ED25519 , 0 , pw );
18341853 }
18351854 }
18361855 if (options -> escape_char == -1 )
@@ -1843,9 +1862,17 @@ fill_default_options(Options * options)
18431862 }
18441863 if (options -> num_user_hostfiles == 0 ) {
18451864 options -> user_hostfiles [options -> num_user_hostfiles ++ ] =
1865+ #ifdef WIN32_FIXME
1866+ user_hostfile_name ;
1867+ #else
18461868 xstrdup (_PATH_SSH_USER_HOSTFILE );
1869+ #endif
18471870 options -> user_hostfiles [options -> num_user_hostfiles ++ ] =
1871+ #ifdef WIN32_FIXME
1872+ user_hostfile_name2 ;
1873+ #else
18481874 xstrdup (_PATH_SSH_USER_HOSTFILE2 );
1875+ #endif
18491876 }
18501877 if (options -> log_level == SYSLOG_LEVEL_NOT_SET )
18511878 options -> log_level = SYSLOG_LEVEL_INFO ;
0 commit comments