mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-06 04:51:40 -07:00
Fix svn_client_list3 function call deprecation
Update the module to support subversion lib from v1.5 to 1.10 and fix following warning: hydra-svn.c:124:3: warning: \u2018svn_client_list3\u2019 is deprecated [-Wdeprecated-declarations] err = svn_client_list3(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool);
This commit is contained in:
parent
9ae7ed075a
commit
b3ddd4a2d2
1 changed files with 22 additions and 0 deletions
22
hydra-svn.c
22
hydra-svn.c
|
@ -10,12 +10,15 @@
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <svn_version.h>
|
||||||
#include <svn_client.h>
|
#include <svn_client.h>
|
||||||
#include <svn_cmdline.h>
|
#include <svn_cmdline.h>
|
||||||
#include <svn_pools.h>
|
#include <svn_pools.h>
|
||||||
#include <svn_config.h>
|
#include <svn_config.h>
|
||||||
#include <svn_fs.h>
|
#include <svn_fs.h>
|
||||||
|
#if SVN_VER_MINOR > 7
|
||||||
#include <svn_path.h>
|
#include <svn_path.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -58,7 +61,9 @@ int32_t start_svn(int32_t s, char *ip, int32_t port, unsigned char options, char
|
||||||
//int32_t ipv6 = 0;
|
//int32_t ipv6 = 0;
|
||||||
char URL[1024];
|
char URL[1024];
|
||||||
char URLBRANCH[256];
|
char URLBRANCH[256];
|
||||||
|
#if SVN_VER_MINOR > 7
|
||||||
const char *canonical;
|
const char *canonical;
|
||||||
|
#endif
|
||||||
apr_pool_t *pool;
|
apr_pool_t *pool;
|
||||||
svn_error_t *err;
|
svn_error_t *err;
|
||||||
svn_opt_revision_t revision;
|
svn_opt_revision_t revision;
|
||||||
|
@ -87,7 +92,11 @@ int32_t start_svn(int32_t s, char *ip, int32_t port, unsigned char options, char
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SVN_VER_MINOR > 7
|
||||||
if ((err = svn_client_create_context2(&ctx, NULL, pool))) {
|
if ((err = svn_client_create_context2(&ctx, NULL, pool))) {
|
||||||
|
#else
|
||||||
|
if ((err = svn_client_create_context(&ctx, pool))) {
|
||||||
|
#endif
|
||||||
svn_pool_destroy(pool);
|
svn_pool_destroy(pool);
|
||||||
svn_handle_error2(err, stderr, FALSE, "hydra: ");
|
svn_handle_error2(err, stderr, FALSE, "hydra: ");
|
||||||
return 4;
|
return 4;
|
||||||
|
@ -111,8 +120,15 @@ int32_t start_svn(int32_t s, char *ip, int32_t port, unsigned char options, char
|
||||||
revision.kind = svn_opt_revision_head;
|
revision.kind = svn_opt_revision_head;
|
||||||
snprintf(URL, sizeof(URL), "svn://%s:%d/%s", hydra_address2string_beautiful(ip), port, URLBRANCH);
|
snprintf(URL, sizeof(URL), "svn://%s:%d/%s", hydra_address2string_beautiful(ip), port, URLBRANCH);
|
||||||
dirents = SVN_DIRENT_KIND;
|
dirents = SVN_DIRENT_KIND;
|
||||||
|
#if SVN_VER_MINOR > 9
|
||||||
|
canonical = svn_uri_canonicalize(URL, pool);
|
||||||
|
err = svn_client_list4(canonical, &revision, &revision, NULL, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool);
|
||||||
|
#elif SVN_VER_MINOR > 7
|
||||||
canonical = svn_uri_canonicalize(URL, pool);
|
canonical = svn_uri_canonicalize(URL, pool);
|
||||||
err = svn_client_list3(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool);
|
err = svn_client_list3(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, FALSE, (svn_client_list_func2_t) print_dirdummy, NULL, ctx, pool);
|
||||||
|
#else
|
||||||
|
err = svn_client_list2(URL, &revision, &revision, svn_depth_unknown, dirents, FALSE, print_dirdummy, NULL, ctx, pool);
|
||||||
|
#endif
|
||||||
|
|
||||||
svn_pool_destroy(pool);
|
svn_pool_destroy(pool);
|
||||||
|
|
||||||
|
@ -211,6 +227,12 @@ int32_t service_svn_init(char *ip, int32_t sp, unsigned char options, char *misc
|
||||||
// 0 all OK
|
// 0 all OK
|
||||||
// -1 error, hydra will exit, so print a good error message here
|
// -1 error, hydra will exit, so print a good error message here
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
hydra_report(stderr, "[VERBOSE] detected subversion library v%d.%d\n", SVN_VER_MAJOR, SVN_VER_MINOR);
|
||||||
|
if (SVN_VER_MAJOR != 1 && SVN_VER_MINOR >= 5) {
|
||||||
|
hydra_report(stderr, "[ERROR] unsupported subversion library v%d.%d, exiting!\n", SVN_VER_MAJOR, SVN_VER_MINOR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue