24
24
#ifdef WIN32_FIXME
25
25
#undef GSSAPI
26
26
#undef KRB5
27
+
28
+ #define true 1
29
+ #define false 0
30
+
27
31
#endif
28
32
29
33
#include <sys/param.h> /* MIN */
98
102
#define stat (PATH , BUF ) _stat(PATH, BUF)
99
103
100
104
char * get_inside_path (char * , BOOL , BOOL );
105
+ int readlink (const char * path , char * link , int linklen );
101
106
102
107
/*
103
108
* Function to cut last slash (windows
@@ -1521,31 +1526,6 @@ if (realpathWin32i(newpath, resolvedname))
1521
1526
static void
1522
1527
process_readlink (u_int32_t id )
1523
1528
{
1524
- #ifdef WIN32_FIXME
1525
-
1526
- /*
1527
- * Win32 code.
1528
- */
1529
-
1530
- //u_int32_t id;
1531
-
1532
- char * request ;
1533
-
1534
- //id = get_int();
1535
- #ifndef WIN32_FIXME
1536
- // PRAGMA:TODO
1537
- request = get_string (NULL );
1538
-
1539
- send_status (id , SSH2_FX_OP_UNSUPPORTED );
1540
-
1541
- free (request );
1542
- #endif
1543
-
1544
- #else
1545
-
1546
- /*
1547
- * Original OpenSSH code.
1548
- */
1549
1529
int r , len ;
1550
1530
char buf [PATH_MAX ];
1551
1531
char * path ;
@@ -1555,6 +1535,16 @@ process_readlink(u_int32_t id)
1555
1535
1556
1536
debug3 ("request %u: readlink" , id );
1557
1537
verbose ("readlink \"%s\"" , path );
1538
+
1539
+ #ifdef WIN32_FIXME
1540
+ char resolvedname [MAXPATHLEN ];
1541
+ if (realpathWin32i (path , resolvedname ))
1542
+ {
1543
+ free (path );
1544
+ path = strdup (resolvedname );
1545
+ }
1546
+ #endif
1547
+
1558
1548
if ((len = readlink (path , buf , sizeof (buf ) - 1 )) == -1 )
1559
1549
send_status (id , errno_to_portable (errno ));
1560
1550
else {
@@ -1566,37 +1556,13 @@ process_readlink(u_int32_t id)
1566
1556
send_names (id , 1 , & s );
1567
1557
}
1568
1558
free (path );
1569
- #endif /* WIN32_FIXME */
1559
+
1570
1560
}
1571
1561
1572
1562
static void
1573
1563
process_symlink (u_int32_t id )
1574
1564
{
1575
- #ifdef WIN32_FIXME
1576
-
1577
- /*
1578
- * Win32 code.
1579
- */
1580
-
1581
- //u_int32_t id;
1582
-
1583
- char * request ;
1584
1565
1585
- //id = get_int();
1586
- #ifndef WIN32_FIXME
1587
- // PRAGMA:TODO
1588
- request = get_string (NULL );
1589
-
1590
- send_status (id , SSH2_FX_OP_UNSUPPORTED );
1591
-
1592
- free (request );
1593
- #endif
1594
-
1595
- #else
1596
-
1597
- /*
1598
- * Original OpenSSH code.
1599
- */
1600
1566
char * oldpath , * newpath ;
1601
1567
int r , status ;
1602
1568
@@ -1606,13 +1572,19 @@ process_symlink(u_int32_t id)
1606
1572
1607
1573
debug3 ("request %u: symlink" , id );
1608
1574
logit ("symlink old \"%s\" new \"%s\"" , oldpath , newpath );
1575
+
1576
+ #ifdef WIN32_FIXME
1577
+ send_status (id , SSH2_FX_OP_UNSUPPORTED );
1578
+ #else
1579
+
1609
1580
/* this will fail if 'newpath' exists */
1610
1581
r = symlink (oldpath , newpath );
1611
1582
status = (r == -1 ) ? errno_to_portable (errno ) : SSH2_FX_OK ;
1612
1583
send_status (id , status );
1584
+ #endif
1585
+
1613
1586
free (oldpath );
1614
1587
free (newpath );
1615
- #endif
1616
1588
}
1617
1589
1618
1590
static void
0 commit comments