亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ftp.c

?? 站點(diǎn)映像程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*    sitecopy, for managing remote web sites. Generic(ish) FTP routines.   Copyright (C) 1998-99, Joe Orton <joe@orton.demon.co.uk> (except   where otherwise indicated).                                                                        This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.     This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.     You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.     $Id: ftp.c,v 1.12.2.6 1999/08/19 10:26:07 joe Exp $*//* This contains an FTP client implementation. * It performs transparent connection management - it it dies, * it will be reconnected automagically. */#include <config.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h>#include <netinet/in.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <stdio.h>#include <time.h>#ifdef HAVE_STRING_H#include <string.h>#endif#ifdef HAVE_STRINGS_H#include <strings.h>#endif #ifdef HAVE_STDLIB_H#include <stdlib.h>#endif /* HAVE_STDLIB_H */#ifdef HAVE_UNISTD_H#include <unistd.h>#endif /* HAVE_UNISTD_H */#ifndef HAVE_SNPRINTF#include "snprintf.h"#endif#include "common.h"#include "frontend.h"#include "ftp.h"#include "protocol.h"#include "socket.h"char ftp_error[BUFSIZ];bool ftp_use_passive = true; /* whether we use PASV mode or not *//* The address of the server for the DTP connection -  * this goes here because it's got from ftp_read() rather than in a decent * manner */unsigned short ftp_dtp_port;struct in_addr ftp_dtp_addr;int ftp_dtp_socket;struct in_addr ftp_pi_addr;unsigned short ftp_pi_port;int ftp_pi_socket;bool ftp_connection; /* true when open *//* Reply codes - these are returned by internal functions, * ftp_exec and ftp_open mainly. */#define FTP_OK 0#define FTP_NEEDPASSWORD 1#define FTP_PASSIVE 2#define FTP_READY 3#define FTP_FILEMORE 4#define FTP_MODTIME 5#define FTP_SENT 6#define FTP_CLOSED 101#define FTP_FILEBAD 102#define FTP_CONNECT 992#define FTP_HELLO 993#define FTP_LOGIN 994#define FTP_BROKEN 995#define FTP_DENIED 996#define FTP_UNSUPPORTED 997#define FTP_NOPASSIVE 998#define FTP_ERROR 999/* time from MDTM response */time_t ftp_modtime;/* remember these... we may have to log in more than once. */char *ftp_username, *ftp_password;/* Stores the current transfer type is: *  -1: Unknown *   0: Binary *   1: ASCII */int ftp_using_ascii;/* Opens the control connection if necessary. * Returns: *   FTP_OK on success *   FTP_CONNECT on failed socket connect *   FTP_HELLO if the greeting message couldn't be read *   FTP_LOGIN on failed login */int ftp_open( void );int ftp_close( void );int ftp_fetch_gettree( const char *startdir, struct proto_file_t **files );int ftp_fetch_walktree( const char *rotodir, struct proto_file_t *files );int ftp_login( void ); /* Performs the login procedure */int ftp_settype( bool ascii );int ftp_active_open(const char * );int ftp_data_open( const char * ); /* Opens the data connection */int ftp_data_close( void ); /* Closes the data connection */int ftp_connect_pasv( void );int ftp_read_pasv( const char * ); /* Used by ftp_response to get the remote IP */int ftp_read_mdtm( const char *response );int ftp_response( const char *, const int ); /* Gets the return code */int get_reply_code( const char * ); /* Used by ftp_response to get the actual code */int ftp_exec( const char * ); /* Executes given command, reads response */int ftp_read( void );/* Initializes the driver + connection. * Returns PROTO_OK on success, or PROTO_LOOKUP if the hostname * could not be resolved. */int ftp_init( const char *remote_root, 	      struct proto_host_t *server, struct proto_host_t *proxy ) {    ftp_pi_port = server->port;    fe_connection( fe_namelookup );    if( host_lookup( server->hostname, &ftp_pi_addr ) )	return PROTO_LOOKUP;    ftp_username = server->username;    ftp_password = server->password;    ftp_connection = false;    ftp_using_ascii = -1; /* unknown */    switch( ftp_open() ) {    case FTP_CONNECT:    case FTP_HELLO:	return PROTO_CONNECT;    case FTP_LOGIN:	return PROTO_AUTH;    default:	return PROTO_OK;    }}/* Cleans up and closes the control connection. * Returns PROTO_OK if the connection is closed, else PROTO_ERROR; */int ftp_finish( void ) {    if( ftp_connection )	if( ftp_close( ) != FTP_CLOSED )	    return PROTO_ERROR;    return PROTO_OK;}/* Closes the PI connection. */int ftp_close( ) {    int ret;    ret = ftp_exec( "QUIT" );    close( ftp_pi_socket );    ftp_connection = false; /* although it should have been done already */    return ret;}/* Creates the given directory * FTP state response */int ftp_mkdir( const char *dir ) {    char command[BUFSIZ];    snprintf( command, BUFSIZ, "MKD %s", dir );    if( ftp_exec( command ) == FTP_OK ) {	return PROTO_OK;    } else {	return PROTO_ERROR;    }} /* Renames or moves a file */int ftp_move( const char *from, const char *to ) {    char command[BUFSIZ];    snprintf( command, BUFSIZ, "RNFR %s", from );    if( ftp_exec( command ) == FTP_FILEMORE ) {	snprintf( command, BUFSIZ, "RNTO %s", to );	if( ftp_exec( command ) == PROTO_OK ) {	    return PROTO_OK;	}    }    return PROTO_ERROR;}int ftp_delete( const char *filename ) {    char command[BUFSIZ];    snprintf( command, BUFSIZ, "DELE %s", filename );    if( ftp_exec( command ) == FTP_OK ) {	return PROTO_OK;    } else {	return PROTO_ERROR;    }}int ftp_rmdir( const char *filename ) {    char command[BUFSIZ];    snprintf( command, BUFSIZ, "RMD %s", filename );    if( ftp_exec( command ) == FTP_OK ) {	return PROTO_OK;    } else {	return PROTO_ERROR;    }}/* FTP non-PASV mode open */int ftp_active_open(const char *command) {    char *a, *p;    int ret;    ksize_t slen;    int listener;    char cmd[BUFSIZ];    struct sockaddr_in gotaddr;    struct sockaddr_in localaddr;    if( ftp_open( ) != FTP_OK ) return FTP_ERROR;        slen = sizeof( localaddr );    if( getsockname( ftp_pi_socket, (struct sockaddr *)&localaddr, &slen ) < 0 ) {	ftp_seterror_err( "Could not get socket name" );	return FTP_ERROR;    }    /* But let bind pick a random port for us to use */    localaddr.sin_port = 0;    /* Create a local socket to accept the connection on */    listener = socket( AF_INET, SOCK_STREAM, 0 );    if ( listener < 0 ) {	ftp_seterror_err( "Could not create socket" );	return FTP_ERROR;    }    /* Bind it to a port. */    if ( bind(listener, (struct sockaddr *)&localaddr, sizeof(struct sockaddr_in)) < 0 ) {	ftp_seterror_err( "Could not bind socket." );	close( listener );	return FTP_ERROR;    }    slen = sizeof( struct sockaddr_in );    if (getsockname(listener, (struct sockaddr *)&gotaddr, &slen) < 0) {	ftp_seterror_err( "Could get get name of socket" );	close( listener );	return FTP_ERROR;    }    if (listen(listener, 1) < 0) {	ftp_seterror_err( "Could not listen for connection" );	close( listener );	return FTP_ERROR;    }    /* Let the remote end know the address of our port.     * Q(joe): Will this actually work on differently-endian machines?      */#define	UC(b)	(((int)b)&0xff)    a = (char *)&gotaddr.sin_addr.s_addr;    p = (char *)&gotaddr.sin_port;        snprintf(cmd, BUFSIZ, "PORT %d,%d,%d,%d,%d,%d",	     UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),	     UC(p[0]), UC(p[1]) );    /* Execute the PORT command */    ret = ftp_exec(cmd);    if( ret != FTP_OK ) {	/* Failed to execute the PORT command - close the socket */	DEBUG( DEBUG_FTP, "PORT command failed.\n" );	close( listener );	return ret;    }    /* Send the command.  This will make the remote end     * initiate the connection.     */    ret = ftp_exec(command);        if( ret != FTP_READY ) {	/* Do they want it? */	DEBUG( DEBUG_FTP, "Command failed.\n" );	close( listener );	return ret;    }    /* Now wait for a connection from the remote end.     */    ftp_dtp_socket = accept( listener, NULL, NULL );    if (ftp_dtp_socket < 0) {	close( listener );	ftp_seterror_err( "Could not accept connection" );	return FTP_ERROR;    }    close( listener );        return ret;}int ftp_chmod( const char *filename, const mode_t mode ) {    char command[BUFSIZ];    snprintf( command, BUFSIZ, "SITE CHMOD %3o %s", mode & 0777, filename );    if( ftp_exec( command ) == FTP_OK ) {	return PROTO_OK;    } else {	return PROTO_ERROR;    }}int ftp_data_open( const char *command ) {    int ret;    if( ftp_use_passive ) {	ret = ftp_exec( "PASV" );	if( ret == FTP_PASSIVE ) {	    if( ftp_connect_pasv( ) ) {		return ftp_exec( command );	    } else {		return FTP_ERROR;	    }	} else {	    return FTP_NOPASSIVE;	}    } else {	/* we are not using passive mode. */	return ftp_active_open(command);    }}/* Closes the data connection */int ftp_data_close( ) {    /* Read the response line */    if( close( ftp_dtp_socket ) < 0 ) {	ftp_seterror_err( "Error closing data socket" );	return FTP_ERROR;    } else {	return ftp_read();    }}/* Set the transfer type appropriately. * Only set it if it *needs* setting, though. * Returns FTP_OK on success, or something else otherwise. */int ftp_settype( bool ascii ) {    int newascii, ret;    newascii = ascii?1:0;    if( (ftp_using_ascii == -1) || (newascii != ftp_using_ascii ) ) {	ret = ftp_exec( ascii?"TYPE A":"TYPE I" );	if( ret == FTP_OK ) {	    ftp_using_ascii = newascii;	} else {	    ftp_using_ascii = -1; /* unknown */	}    } else {	ret = FTP_OK;    }    return ret;}/* upload the given file */int ftp_put( const char *localfile, const char *remotefile, const bool ascii ) {    char command[BUFSIZ];    /* Set the transfer type correctly */    if( ftp_settype( ascii ) != FTP_OK )	return PROTO_ERROR;    snprintf( command, BUFSIZ, "STOR %s", remotefile );    if( ftp_data_open( command ) == FTP_READY ) {	int ret;	/* Send the file. FIXME: We rely on the server's return	 * code to determine whether the transfer was successful. */	if( ascii ) {	    ret = send_file_ascii( ftp_dtp_socket, localfile );	} else {	    ret = send_file_binary( ftp_dtp_socket, localfile );	}	if( ret > 0 ) { 	    DEBUG( DEBUG_FTP, "Error sending file... ignoring.\n" );	}	if( ftp_data_close( ) == FTP_SENT ) {	    return PROTO_OK;	}    }    return PROTO_ERROR;}/* Slightly dodgy ftp_get in that you need to know the remote file * size. Works, but not very generic. */int ftp_get( const char *localfile, const char *remotefile, 	     const int remotesize, const bool ascii ) {    char command[BUFSIZ];    int ret;    if(ascii) strcpy( command, "TYPE A" );    else strcpy( command, "TYPE I");    ret = ftp_exec( command );    snprintf( command, BUFSIZ, "RETR %s", remotefile );    if( ftp_data_open( command ) == FTP_READY ) {	/* send the file */	recv_file( ftp_dtp_socket, localfile, remotesize );	if( ftp_data_close( ) == FTP_SENT ) {	    return PROTO_OK;	}    }    return PROTO_ERROR;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品福利二区三区| 欧美日韩国产成人在线91| 亚洲成人精品一区| 一区二区三区四区五区视频在线观看| 久久精品日产第一区二区三区高清版| 欧美精品一区二区三区高清aⅴ| 日韩一区二区影院| 精品伦理精品一区| 久久精品一区蜜桃臀影院| 精品久久久久久久久久久院品网 | 欧美激情一区二区在线| 久久亚洲欧美国产精品乐播| 久久中文娱乐网| 亚洲欧洲三级电影| 一区二区三区四区国产精品| 亚洲国产成人精品视频| 日韩av不卡在线观看| 精品午夜一区二区三区在线观看| 久久9热精品视频| 成人性视频免费网站| 91麻豆国产福利在线观看| 欧美日韩国产免费一区二区| 日韩欧美国产午夜精品| 国产精品毛片高清在线完整版| 亚洲欧洲制服丝袜| 蜜臀久久久久久久| av电影在线观看完整版一区二区| 在线视频观看一区| 久久久亚洲精品石原莉奈| 亚洲美女偷拍久久| 狠狠色丁香久久婷婷综| 白白色 亚洲乱淫| 欧美日韩久久不卡| 中文字幕av一区 二区| 亚洲图片欧美色图| 成人午夜激情在线| 日韩视频免费观看高清完整版在线观看| 久久久久久99久久久精品网站| 亚洲欧美一区二区久久 | 国产精品99久久久久久宅男| 97超碰欧美中文字幕| 欧美精品99久久久**| 国产亚洲欧洲997久久综合 | 国产精品一区三区| 欧美综合一区二区| 中文字幕av免费专区久久| 日韩精品三区四区| 99精品国产99久久久久久白柏| 777精品伊人久久久久大香线蕉| 国产精品福利一区| 黑人巨大精品欧美黑白配亚洲| 在线观看一区不卡| 国产精品美女久久久久久久久| 美脚の诱脚舐め脚责91 | 久久精品在这里| 日韩黄色一级片| 91在线视频观看| 久久精品亚洲国产奇米99| 日韩成人午夜精品| 欧美性生活久久| 亚洲私人影院在线观看| 高清视频一区二区| 久久伊人蜜桃av一区二区| 日韩影院精彩在线| 欧美日韩精品免费| 亚洲午夜久久久久| 91福利国产精品| 亚洲美腿欧美偷拍| 91搞黄在线观看| 一区二区三区免费看视频| 成人毛片视频在线观看| 欧美激情综合五月色丁香小说| 久久99九九99精品| 久久亚洲精品国产精品紫薇| 久久不见久久见免费视频7| 日韩欧美国产一二三区| 久久99精品久久久久久| 精品剧情v国产在线观看在线| 日本中文字幕一区二区有限公司| 欧美一区二区三区免费在线看| 五月婷婷激情综合| 欧美一区二区三区人| 久久国产精品无码网站| 久久女同性恋中文字幕| 国产成人午夜精品影院观看视频| 国产三级一区二区| av一本久道久久综合久久鬼色| 亚洲天堂2016| 欧美三级一区二区| 久久精品国产在热久久| 久久久久久久电影| 91色视频在线| 日韩电影免费在线观看网站| 欧美一区二区性放荡片| 国产麻豆精品视频| ...中文天堂在线一区| 欧美日韩一区视频| 老司机精品视频导航| 中文乱码免费一区二区 | 亚洲一级电影视频| 91精品国产乱| 99久久精品国产导航| 亚洲成人1区2区| 久久综合久久久久88| www.色精品| 日韩高清不卡一区二区| 久久久精品免费网站| 色婷婷av一区二区三区gif | 久久理论电影网| 91蜜桃免费观看视频| 男男gaygay亚洲| 中文一区一区三区高中清不卡| 色av成人天堂桃色av| 久久精品国产在热久久| 亚洲日本一区二区三区| 日韩一级免费观看| 99精品视频免费在线观看| 日韩福利电影在线观看| 亚洲婷婷在线视频| 久久久久久久久久久久久久久99| 91成人免费电影| 粉嫩av亚洲一区二区图片| 天天影视涩香欲综合网| 17c精品麻豆一区二区免费| 欧美白人最猛性xxxxx69交| 欧美影院精品一区| 91尤物视频在线观看| 国产精品一区二区果冻传媒| 天天综合日日夜夜精品| 亚洲乱码国产乱码精品精98午夜| 精品国产精品一区二区夜夜嗨| 欧美三级视频在线观看| 色综合久久88色综合天天6| 国产91丝袜在线观看| 激情综合色综合久久| 丝袜亚洲另类欧美| 亚洲电影你懂得| 亚洲成人激情自拍| 亚洲二区在线视频| 亚洲裸体在线观看| 成人免费在线视频| 国产精品丝袜久久久久久app| 欧美精品一区二区三区蜜桃| 日韩午夜在线观看| 欧美一区午夜视频在线观看| 欧美曰成人黄网| 欧美日韩一区视频| 欧美日韩性生活| 911精品产国品一二三产区| 欧美日韩国产综合一区二区三区| 欧美性xxxxx极品少妇| 91官网在线免费观看| 在线观看www91| 欧美日韩电影一区| 51精品视频一区二区三区| 欧美日韩精品欧美日韩精品| 欧美男生操女生| 日韩欧美综合在线| 亚洲精品在线一区二区| 久久久综合精品| 国产精品欧美一区喷水| **性色生活片久久毛片| 亚洲精品成人精品456| 亚洲国产精品视频| 视频一区二区三区在线| 麻豆国产欧美日韩综合精品二区 | 欧美一区二区三区视频在线| 欧美一级午夜免费电影| 欧美电视剧在线看免费| 日韩一区二区三区免费观看| 久久综合久久综合久久| 国产精品国产三级国产有无不卡| 亚洲欧洲在线观看av| 亚洲午夜精品久久久久久久久| 天堂一区二区在线| 久久精品国产亚洲aⅴ| 国产精品亚洲专一区二区三区| 北条麻妃一区二区三区| 91福利国产精品| 精品国产凹凸成av人网站| 国产视频一区二区三区在线观看| 成人免费在线播放视频| 无码av中文一区二区三区桃花岛| 韩国三级在线一区| 99久久精品国产网站| 欧美一区二区免费观在线| 日本一区免费视频| 亚洲成av人片在线观看无码| 国内精品久久久久影院薰衣草| 91看片淫黄大片一级| 久久综合色天天久久综合图片| 亚洲摸摸操操av| 激情深爱一区二区| 欧美综合色免费| 欧美国产精品一区二区| 三级在线观看一区二区| 成人动漫精品一区二区| 欧美tickling挠脚心丨vk| 一二三区精品视频| 福利一区二区在线|