comparison lib/sshv2.c @ 14:83090328581e

* More largefile support. Hopefully all that is left is the configure stuff * Sanity checking on the fdopen() calls. Also make sure that all of them have a + in their open mode. Doesn't affect UNIX, but it does affect Windows * HTTP fixes when running under Solaris. Read from request->sockfd and write to request->sockfd_write (Solaris doesn't like it when you read/write to the same FILE structure) * Display major/minor properly for a device when connected with the local protocol
author masneyb
date Wed, 04 Sep 2002 11:45:56 +0000
parents 8b1883341c6f
children c8ec7877432e
comparison
equal deleted inserted replaced
13:cd2e26a69461 14:83090328581e
354 g_free (tempstr); 354 g_free (tempstr);
355 } 355 }
356 g_free (args); 356 g_free (args);
357 g_free (exepath); 357 g_free (exepath);
358 358
359 request->sockfd = request->datafd = fdopen (fdm, "rb"); 359 if ((request->sockfd = fdopen (fdm, "rb+")) == NULL)
360 request->sockfd_write = fdopen (fdm, "wb"); 360 {
361 request->logging_function (gftp_logging_error, request->user_data,
362 _("Cannot fdopen() socket: %s\n"),
363 g_strerror (errno));
364 close (fdm);
365 return (-2);
366 }
367
368 if ((request->sockfd_write = fdopen (fdm, "wb+")) == NULL)
369 {
370 request->logging_function (gftp_logging_error, request->user_data,
371 _("Cannot fdopen() socket: %s\n"),
372 g_strerror (errno));
373 gftp_disconnect (request);
374 return (-2);
375 }
361 376
362 version = htonl (SSH_MY_VERSION); 377 version = htonl (SSH_MY_VERSION);
363 if (sshv2_send_command (request, SSH_FXP_INIT, (char *) &version, 4) < 0) 378 if (sshv2_send_command (request, SSH_FXP_INIT, (char *) &version, 4) < 0)
364 return (-2); 379 return (-2);
365 380
409 { 424 {
410 request->logging_function (gftp_logging_misc, request->user_data, 425 request->logging_function (gftp_logging_misc, request->user_data,
411 _("Disconnecting from site %s\n"), 426 _("Disconnecting from site %s\n"),
412 request->hostname); 427 request->hostname);
413 fclose (request->sockfd); 428 fclose (request->sockfd);
414 request->sockfd = request->datafd = request->sockfd_write = NULL; 429 request->sockfd = request->sockfd_write = NULL;
415 } 430 }
416 431
417 if (params->message.buffer != NULL) 432 if (params->message.buffer != NULL)
418 sshv2_message_free (&params->message); 433 sshv2_message_free (&params->message);
419 } 434 }
778 sshv2_message message; 793 sshv2_message message;
779 gint32 len; 794 gint32 len;
780 795
781 g_return_val_if_fail (request != NULL, -2); 796 g_return_val_if_fail (request != NULL, -2);
782 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 797 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
783 g_return_val_if_fail (request->datafd != NULL, -2);
784 798
785 params = request->protocol_data; 799 params = request->protocol_data;
786 if (params->message.buffer != NULL) 800 if (params->message.buffer != NULL)
787 { 801 {
788 sshv2_message_free (&params->message); 802 sshv2_message_free (&params->message);
1085 gint32 num; 1099 gint32 num;
1086 size_t len; 1100 size_t len;
1087 1101
1088 g_return_val_if_fail (request != NULL, -2); 1102 g_return_val_if_fail (request != NULL, -2);
1089 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1103 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1090 g_return_val_if_fail (request->datafd != NULL, -2);
1091 1104
1092 params = request->protocol_data; 1105 params = request->protocol_data;
1093 if (request->directory != directory) 1106 if (request->directory != directory)
1094 { 1107 {
1095 if (*directory == '/') 1108 if (*directory == '/')
1155 gint32 num; 1168 gint32 num;
1156 size_t len; 1169 size_t len;
1157 1170
1158 g_return_val_if_fail (request != NULL, -2); 1171 g_return_val_if_fail (request != NULL, -2);
1159 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1172 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1160 g_return_val_if_fail (request->datafd != NULL, -2);
1161 1173
1162 if (request->directory == NULL || *request->directory == '\0') 1174 if (request->directory == NULL || *request->directory == '\0')
1163 dir = "."; 1175 dir = ".";
1164 else 1176 else
1165 dir = request->directory; 1177 dir = request->directory;
1217 gint32 num; 1229 gint32 num;
1218 size_t len; 1230 size_t len;
1219 1231
1220 g_return_val_if_fail (request != NULL, -2); 1232 g_return_val_if_fail (request != NULL, -2);
1221 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1233 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1222 g_return_val_if_fail (request->datafd != NULL, -2);
1223 g_return_val_if_fail (directory != NULL, -2); 1234 g_return_val_if_fail (directory != NULL, -2);
1224 1235
1225 params = request->protocol_data; 1236 params = request->protocol_data;
1226 1237
1227 if (*directory == '/') 1238 if (*directory == '/')
1275 gint32 num; 1286 gint32 num;
1276 size_t len; 1287 size_t len;
1277 1288
1278 g_return_val_if_fail (request != NULL, -2); 1289 g_return_val_if_fail (request != NULL, -2);
1279 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1290 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1280 g_return_val_if_fail (request->datafd != NULL, -2);
1281 g_return_val_if_fail (file != NULL, -2); 1291 g_return_val_if_fail (file != NULL, -2);
1282 1292
1283 params = request->protocol_data; 1293 params = request->protocol_data;
1284 1294
1285 if (*file == '/') 1295 if (*file == '/')
1333 gint32 num; 1343 gint32 num;
1334 size_t len; 1344 size_t len;
1335 1345
1336 g_return_val_if_fail (request != NULL, -2); 1346 g_return_val_if_fail (request != NULL, -2);
1337 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1347 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1338 g_return_val_if_fail (request->datafd != NULL, -2);
1339 g_return_val_if_fail (file != NULL, -2); 1348 g_return_val_if_fail (file != NULL, -2);
1340 1349
1341 params = request->protocol_data; 1350 params = request->protocol_data;
1342 1351
1343 if (*file == '/') 1352 if (*file == '/')
1398 gint32 num; 1407 gint32 num;
1399 size_t len; 1408 size_t len;
1400 1409
1401 g_return_val_if_fail (request != NULL, -2); 1410 g_return_val_if_fail (request != NULL, -2);
1402 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1411 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1403 g_return_val_if_fail (request->datafd != NULL, -2);
1404 g_return_val_if_fail (newdir != NULL, -2); 1412 g_return_val_if_fail (newdir != NULL, -2);
1405 1413
1406 params = request->protocol_data; 1414 params = request->protocol_data;
1407 1415
1408 if (*newdir == '/') 1416 if (*newdir == '/')
1457 gint32 num; 1465 gint32 num;
1458 size_t oldlen, newlen; 1466 size_t oldlen, newlen;
1459 1467
1460 g_return_val_if_fail (request != NULL, -2); 1468 g_return_val_if_fail (request != NULL, -2);
1461 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1469 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1462 g_return_val_if_fail (request->datafd != NULL, -2);
1463 g_return_val_if_fail (oldname != NULL, -2); 1470 g_return_val_if_fail (oldname != NULL, -2);
1464 g_return_val_if_fail (newname != NULL, -2); 1471 g_return_val_if_fail (newname != NULL, -2);
1465 1472
1466 params = request->protocol_data; 1473 params = request->protocol_data;
1467 1474
1529 gint32 num; 1536 gint32 num;
1530 size_t len; 1537 size_t len;
1531 1538
1532 g_return_val_if_fail (request != NULL, -2); 1539 g_return_val_if_fail (request != NULL, -2);
1533 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1540 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1534 g_return_val_if_fail (request->datafd != NULL, -2);
1535 g_return_val_if_fail (file != NULL, -2); 1541 g_return_val_if_fail (file != NULL, -2);
1536 1542
1537 params = request->protocol_data; 1543 params = request->protocol_data;
1538 1544
1539 if (*file == '/') 1545 if (*file == '/')
1597 gint64 ret; 1603 gint64 ret;
1598 #endif 1604 #endif
1599 1605
1600 g_return_val_if_fail (request != NULL, -2); 1606 g_return_val_if_fail (request != NULL, -2);
1601 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2); 1607 g_return_val_if_fail (request->protonum == GFTP_SSHV2_NUM, -2);
1602 g_return_val_if_fail (request->datafd != NULL, -2);
1603 g_return_val_if_fail (file != NULL, -2); 1608 g_return_val_if_fail (file != NULL, -2);
1604 1609
1605 params = request->protocol_data; 1610 params = request->protocol_data;
1606 1611
1607 if (*file == '/') 1612 if (*file == '/')