From 0d271e168cae82824e1cdd8b11181434b499d1a4 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 7 Nov 2018 14:28:04 -0500 Subject: [PATCH] 2018-11-07 Fred Gleason * Modified rd_deleteaudio(7) in the rivwebcapi to process UTF-8. --- ChangeLog | 2 + apis/rivwebcapi/rivwebcapi/rd_deleteaudio.c | 60 +++++++++++++++++++-- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 442a72c1..def24f9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17988,3 +17988,5 @@ * Fixed buffer overflow bugs in the rd_export(7) rivcwebapi call. * Fixed buffer overflow bugs in the rd_listservices(7) rivcwebapi call. * Fixed buffer overflow bugs in the rd_trimaudio(7) rivcwebapi call. +2018-11-07 Fred Gleason + * Modified rd_deleteaudio(7) in the rivwebcapi to process UTF-8. diff --git a/apis/rivwebcapi/rivwebcapi/rd_deleteaudio.c b/apis/rivwebcapi/rivwebcapi/rd_deleteaudio.c index 2f08992f..8f293c3f 100644 --- a/apis/rivwebcapi/rivwebcapi/rd_deleteaudio.c +++ b/apis/rivwebcapi/rivwebcapi/rd_deleteaudio.c @@ -82,7 +82,9 @@ int RD_DeleteAudio( const char hostname[], char errbuf[CURL_ERROR_SIZE]; CURLcode res; char user_agent_string[255]; - + char cart_buffer[7]; + struct curl_httppost *first=NULL; + struct curl_httppost *last=NULL; if((curl=curl_easy_init())==NULL) { curl_easy_cleanup(curl); @@ -99,13 +101,63 @@ int RD_DeleteAudio( const char hostname[], __DeleteAudioElementEnd); XML_SetCharacterDataHandler(parser,__DeleteAudioElementData); snprintf(url,1500,"http://%s/rd-bin/rdxport.cgi",hostname); + curl_formadd(&first, + &last, + CURLFORM_PTRNAME, + "COMMAND", + CURLFORM_COPYCONTENTS, + "3", + CURLFORM_END); + + curl_formadd(&first, + &last, + CURLFORM_PTRNAME, + "LOGIN_NAME", + CURLFORM_COPYCONTENTS, + username, + CURLFORM_END); + + curl_formadd(&first, + &last, + CURLFORM_PTRNAME, + "PASSWORD", + CURLFORM_COPYCONTENTS, + passwd, + CURLFORM_END); + + curl_formadd(&first, + &last, + CURLFORM_PTRNAME, + "TICKET", + CURLFORM_COPYCONTENTS, + ticket, + CURLFORM_END); + + snprintf(cart_buffer,7,"%u",cartnumber); + curl_formadd(&first, + &last, + CURLFORM_PTRNAME, + "CART_NUMBER", + CURLFORM_COPYCONTENTS, + cart_buffer, + CURLFORM_END); + + snprintf(cart_buffer,7,"%u",cutnumber); + curl_formadd(&first, + &last, + CURLFORM_PTRNAME, + "CUT_NUMBER", + CURLFORM_COPYCONTENTS, + cart_buffer, + CURLFORM_END); + /* snprintf(post,1500,"COMMAND=3&LOGIN_NAME=%s&PASSWORD=%s&TICKET=%s&CART_NUMBER=%u&CUT_NUMBER=%u", curl_easy_escape(curl,username,0), curl_easy_escape(curl,passwd,0), curl_easy_escape(curl,ticket,0), cartnumber, cutnumber); - + */ // Check if User Agent Present otherwise set to default if (strlen(user_agent)> 0){ curl_easy_setopt(curl, CURLOPT_USERAGENT,user_agent); @@ -121,7 +173,7 @@ int RD_DeleteAudio( const char hostname[], curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__DeleteAudioCallback); curl_easy_setopt(curl,CURLOPT_URL,url); curl_easy_setopt(curl,CURLOPT_POST,1); - curl_easy_setopt(curl,CURLOPT_POSTFIELDS,post); + curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errbuf); // curl_easy_setopt(curl,CURLOPT_VERBOSE,1); @@ -136,12 +188,14 @@ int RD_DeleteAudio( const char hostname[], else fprintf(stderr, "%s\n", curl_easy_strerror(res)); #endif + curl_formfree(first); curl_easy_cleanup(curl); return -1; } /* The response OK - so figure out if we got what we wanted.. */ curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code); + curl_formfree(first); curl_easy_cleanup(curl); if (response_code > 199 && response_code < 300) { //Success