@@ -294,6 +294,11 @@ static struct {
294
294
{ NULL , oBadOption }
295
295
};
296
296
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
+
297
302
/*
298
303
* Adds a local TCP/IP port forward to options. Never returns if there is an
299
304
* error.
@@ -379,7 +384,7 @@ clear_forwardings(Options *options)
379
384
380
385
void
381
386
add_identity_file (Options * options , const char * dir , const char * filename ,
382
- int userprovided )
387
+ int userprovided , struct passwd * pw )
383
388
{
384
389
char * path ;
385
390
int i ;
@@ -391,7 +396,12 @@ add_identity_file(Options *options, const char *dir, const char *filename,
391
396
if (dir == NULL ) /* no dir, filename is absolute */
392
397
path = xstrdup (filename );
393
398
else
399
+ #ifndef WIN32_FIXME
394
400
(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
395
405
396
406
/* Avoid registering duplicates */
397
407
for (i = 0 ; i < options -> num_identity_files ; i ++ ) {
@@ -995,7 +1005,7 @@ process_config_line(Options *options, struct passwd *pw, const char *host,
995
1005
fatal ("%.200s line %d: Too many identity files specified (max %d)." ,
996
1006
filename , linenum , SSH_MAX_IDENTITY_FILES );
997
1007
add_identity_file (options , NULL ,
998
- arg , flags & SSHCONF_USERCONF );
1008
+ arg , flags & SSHCONF_USERCONF , pw );
999
1009
}
1000
1010
break ;
1001
1011
@@ -1748,9 +1758,18 @@ fill_default_options_for_canonicalization(Options *options)
1748
1758
* Called after processing other sources of option data, this fills those
1749
1759
* options for which no value has been specified with their default values.
1750
1760
*/
1761
+ #ifndef WIN32_FIXME
1751
1762
void
1752
1763
fill_default_options (Options * options )
1764
+ #else
1765
+ void fill_default_options (Options * options , struct passwd * pw )
1766
+ #endif
1753
1767
{
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
+
1754
1773
if (options -> forward_agent == -1 )
1755
1774
options -> forward_agent = 0 ;
1756
1775
if (options -> forward_x11 == -1 )
@@ -1818,19 +1837,19 @@ fill_default_options(Options * options)
1818
1837
if (options -> num_identity_files == 0 ) {
1819
1838
if (options -> protocol & SSH_PROTO_1 ) {
1820
1839
add_identity_file (options , "~/" ,
1821
- _PATH_SSH_CLIENT_IDENTITY , 0 );
1840
+ _PATH_SSH_CLIENT_IDENTITY , 0 , pw );
1822
1841
}
1823
1842
if (options -> protocol & SSH_PROTO_2 ) {
1824
1843
add_identity_file (options , "~/" ,
1825
- _PATH_SSH_CLIENT_ID_RSA , 0 );
1844
+ _PATH_SSH_CLIENT_ID_RSA , 0 , pw );
1826
1845
add_identity_file (options , "~/" ,
1827
- _PATH_SSH_CLIENT_ID_DSA , 0 );
1846
+ _PATH_SSH_CLIENT_ID_DSA , 0 , pw );
1828
1847
#ifdef OPENSSL_HAS_ECC
1829
1848
add_identity_file (options , "~/" ,
1830
- _PATH_SSH_CLIENT_ID_ECDSA , 0 );
1849
+ _PATH_SSH_CLIENT_ID_ECDSA , 0 , pw );
1831
1850
#endif
1832
1851
add_identity_file (options , "~/" ,
1833
- _PATH_SSH_CLIENT_ID_ED25519 , 0 );
1852
+ _PATH_SSH_CLIENT_ID_ED25519 , 0 , pw );
1834
1853
}
1835
1854
}
1836
1855
if (options -> escape_char == -1 )
@@ -1843,9 +1862,17 @@ fill_default_options(Options * options)
1843
1862
}
1844
1863
if (options -> num_user_hostfiles == 0 ) {
1845
1864
options -> user_hostfiles [options -> num_user_hostfiles ++ ] =
1865
+ #ifdef WIN32_FIXME
1866
+ user_hostfile_name ;
1867
+ #else
1846
1868
xstrdup (_PATH_SSH_USER_HOSTFILE );
1869
+ #endif
1847
1870
options -> user_hostfiles [options -> num_user_hostfiles ++ ] =
1871
+ #ifdef WIN32_FIXME
1872
+ user_hostfile_name2 ;
1873
+ #else
1848
1874
xstrdup (_PATH_SSH_USER_HOSTFILE2 );
1875
+ #endif
1849
1876
}
1850
1877
if (options -> log_level == SYSLOG_LEVEL_NOT_SET )
1851
1878
options -> log_level = SYSLOG_LEVEL_INFO ;
0 commit comments