Lines Matching refs:conn
66 static CURLcode ftpsend(struct Curl_easy *data, struct connectdata *conn, in ftpsend() argument
76 unsigned char data_sec = conn->data_prot; in ftpsend()
92 conn->data_prot = PROT_CMD; in ftpsend()
97 conn->data_prot = data_sec; in ftpsend()
137 struct connectdata *conn UNUSED_PARAM) in krb5_decode()
144 (void)conn; in krb5_decode()
193 krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn) in krb5_auth() argument
197 const char *host = conn->host.name; in krb5_auth()
199 curl_socklen_t l = sizeof(conn->local_addr); in krb5_auth()
213 (struct sockaddr_in *)(void *)&conn->remote_addr->curl_sa_addr; in krb5_auth()
216 if(getsockname(conn->sock[FIRSTSOCKET], in krb5_auth()
217 (struct sockaddr *)&conn->local_addr, &l) < 0) in krb5_auth()
222 chan.initiator_address.value = &conn->local_addr.sin_addr.s_addr; in krb5_auth()
233 result = ftpsend(data, conn, "AUTH GSSAPI"); in krb5_auth()
240 struct pingpong *pp = &conn->proto.ftpc.pp; in krb5_auth()
312 result = ftpsend(data, conn, cmd); in krb5_auth()
329 struct pingpong *pp = &conn->proto.ftpc.pp; in krb5_auth()
455 if(ftpsend(data, data->conn, print_buffer)) { in ftp_send_command()
521 struct connectdata *conn = data->conn; in read_data() local
552 nread = conn->mech->decode(conn->app_data, in read_data()
554 len, conn->data_prot, conn); in read_data()
579 struct connectdata *conn = data->conn; in sec_recv() local
584 if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR) { in sec_recv()
590 if(conn->in_buffer.eof_flag) { in sec_recv()
591 conn->in_buffer.eof_flag = 0; in sec_recv()
595 bytes_read = buffer_read(&conn->in_buffer, buffer, len); in sec_recv()
601 if(read_data(data, sockindex, &conn->in_buffer)) in sec_recv()
603 if(Curl_dyn_len(&conn->in_buffer.buf) == 0) { in sec_recv()
605 conn->in_buffer.eof_flag = 1; in sec_recv()
608 bytes_read = buffer_read(&conn->in_buffer, buffer, len); in sec_recv()
618 static void do_sec_send(struct Curl_easy *data, struct connectdata *conn, in do_sec_send() argument
626 enum protection_level prot_level = conn->data_prot; in do_sec_send()
635 prot_level = conn->command_prot; in do_sec_send()
637 bytes = conn->mech->encode(conn->app_data, from, length, (int)prot_level, in do_sec_send()
672 static ssize_t sec_write(struct Curl_easy *data, struct connectdata *conn, in sec_write() argument
675 ssize_t tx = 0, len = conn->buffer_size; in sec_write()
683 do_sec_send(data, conn, sockindex, buffer, curlx_sztosi(len)); in sec_write()
696 struct connectdata *conn = data->conn; in sec_send() local
699 return sec_write(data, conn, sockindex, buffer, len); in sec_send()
702 int Curl_sec_read_msg(struct Curl_easy *data, struct connectdata *conn, in Curl_sec_read_msg() argument
715 if(!conn->mech) in Curl_sec_read_msg()
731 decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len, in Curl_sec_read_msg()
732 (int)level, conn); in Curl_sec_read_msg()
761 struct connectdata *conn = data->conn; in sec_set_protection_level() local
762 unsigned char level = conn->request_data_prot; in sec_set_protection_level()
766 if(!conn->sec_complete) { in sec_set_protection_level()
773 if(conn->data_prot == level) in sec_set_protection_level()
779 struct pingpong *pp = &conn->proto.ftpc.pp; in sec_set_protection_level()
790 conn->buffer_size = buffer_size; in sec_set_protection_level()
798 if(buffer_size < conn->buffer_size) in sec_set_protection_level()
799 conn->buffer_size = buffer_size; in sec_set_protection_level()
814 conn->data_prot = level; in sec_set_protection_level()
816 conn->command_prot = level; in sec_set_protection_level()
822 Curl_sec_request_prot(struct connectdata *conn, const char *level) in Curl_sec_request_prot() argument
828 conn->request_data_prot = l; in Curl_sec_request_prot()
832 static CURLcode choose_mech(struct Curl_easy *data, struct connectdata *conn) in choose_mech() argument
838 tmp_allocation = realloc(conn->app_data, mech->size); in choose_mech()
844 conn->app_data = tmp_allocation; in choose_mech()
847 ret = mech->init(conn->app_data); in choose_mech()
853 Curl_dyn_init(&conn->in_buffer.buf, CURL_MAX_INPUT_LENGTH); in choose_mech()
882 ret = mech->auth(conn->app_data, data, conn); in choose_mech()
891 conn->mech = mech; in choose_mech()
892 conn->sec_complete = 1; in choose_mech()
893 conn->recv[FIRSTSOCKET] = sec_recv; in choose_mech()
894 conn->send[FIRSTSOCKET] = sec_send; in choose_mech()
895 conn->recv[SECONDARYSOCKET] = sec_recv; in choose_mech()
896 conn->send[SECONDARYSOCKET] = sec_send; in choose_mech()
897 conn->command_prot = PROT_SAFE; in choose_mech()
907 Curl_sec_login(struct Curl_easy *data, struct connectdata *conn) in Curl_sec_login() argument
909 return choose_mech(data, conn); in Curl_sec_login()
914 Curl_sec_end(struct connectdata *conn) in Curl_sec_end() argument
916 if(conn->mech && conn->mech->end) in Curl_sec_end()
917 conn->mech->end(conn->app_data); in Curl_sec_end()
918 Curl_safefree(conn->app_data); in Curl_sec_end()
919 Curl_dyn_free(&conn->in_buffer.buf); in Curl_sec_end()
920 conn->in_buffer.index = 0; in Curl_sec_end()
921 conn->in_buffer.eof_flag = 0; in Curl_sec_end()
922 conn->sec_complete = 0; in Curl_sec_end()
923 conn->data_prot = PROT_CLEAR; in Curl_sec_end()
924 conn->mech = NULL; in Curl_sec_end()