diff options
author | Richard Sharpe <sharpe@samba.org> | 2001-03-09 13:29:06 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@samba.org> | 2001-03-09 13:29:06 +0000 |
commit | 53a331cfb271bd64bb26d0d433439e249adbbe71 (patch) | |
tree | 7c444aa3f03bbb6384db9a6ebbac7086997d3e11 /testsuite/libsmbclient/src/rename | |
parent | e8fcbc5df1d51b2b3683254288f204f42b75e7e9 (diff) | |
download | samba-53a331cfb271bd64bb26d0d433439e249adbbe71.tar.gz samba-53a331cfb271bd64bb26d0d433439e249adbbe71.tar.bz2 samba-53a331cfb271bd64bb26d0d433439e249adbbe71.zip |
Bulk add of the test suite for libsmbclient ...
(This used to be commit adef47b5173b9a028224307490960ce89762709b)
Diffstat (limited to 'testsuite/libsmbclient/src/rename')
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_1.c | 57 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_10.c | 64 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_11.c | 63 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_12.c | 58 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_13.c | 63 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_14.c | 58 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_2.c | 54 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_3.c | 56 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_4.c | 55 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_5.c | 59 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_6.c | 57 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_7.c | 66 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_8.c | 68 | ||||
-rw-r--r-- | testsuite/libsmbclient/src/rename/rename_9.c | 68 |
14 files changed, 846 insertions, 0 deletions
diff --git a/testsuite/libsmbclient/src/rename/rename_1.c b/testsuite/libsmbclient/src/rename/rename_1.c new file mode 100644 index 0000000000..c3e1377c29 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_1.c @@ -0,0 +1,57 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + strncpy(url,argv[4],strlen(argv[4])); + + smbc_init(auth_fn, 0); + err = smbc_rename( url, argv[5] ); + + if ( err < 0 ) + err = 1; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_10.c b/testsuite/libsmbclient/src/rename/rename_10.c new file mode 100644 index 0000000000..01fb144c59 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_10.c @@ -0,0 +1,64 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 9 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[6], strlen(argv[6]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + smbc_mkdir( argv[7], 0700 ); + + strncpy( g_username, argv[4], strlen(argv[4]) ); + strncpy( g_password, argv[5], strlen(argv[5]) ); + + smbc_rename( url, argv[8] ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_11.c b/testsuite/libsmbclient/src/rename/rename_11.c new file mode 100644 index 0000000000..0c34108802 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_11.c @@ -0,0 +1,63 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + err = smbc_rename( NULL, url ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_12.c b/testsuite/libsmbclient/src/rename/rename_12.c new file mode 100644 index 0000000000..cc34e079e1 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_12.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + smbc_rename( NULL, url ); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_13.c b/testsuite/libsmbclient/src/rename/rename_13.c new file mode 100644 index 0000000000..30b33499d6 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_13.c @@ -0,0 +1,63 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + err = smbc_rename( url, NULL ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_14.c b/testsuite/libsmbclient/src/rename/rename_14.c new file mode 100644 index 0000000000..61aad34e72 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_14.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + smbc_rename( url, NULL ); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_2.c b/testsuite/libsmbclient/src/rename/rename_2.c new file mode 100644 index 0000000000..b3d340348c --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_2.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + strncpy(url,argv[4],strlen(argv[4])); + + smbc_init(auth_fn, 0); + smbc_rename( url, argv[5] ); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_3.c b/testsuite/libsmbclient/src/rename/rename_3.c new file mode 100644 index 0000000000..a7508e969c --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_3.c @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + strncpy(url,argv[4],strlen(argv[4])); + + smbc_init(auth_fn, 0); + smbc_open(url,O_RDWR | O_CREAT,0666); + err = smbc_rename( url, argv[5] ); + + if ( err < 0 ) + err = 1; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_4.c b/testsuite/libsmbclient/src/rename/rename_4.c new file mode 100644 index 0000000000..a4c2647001 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_4.c @@ -0,0 +1,55 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + strncpy(url,argv[4],strlen(argv[4])); + + smbc_init(auth_fn, 0); + smbc_open(url,O_RDWR | O_CREAT,0666); + smbc_rename( url, argv[5] ); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_5.c b/testsuite/libsmbclient/src/rename/rename_5.c new file mode 100644 index 0000000000..97fb8fe683 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_5.c @@ -0,0 +1,59 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd ); + err = smbc_rename( url, argv[5] ); + + if ( err < 0 ) + err = 1; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_6.c b/testsuite/libsmbclient/src/rename/rename_6.c new file mode 100644 index 0000000000..c9c349427e --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_6.c @@ -0,0 +1,57 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + strncpy(url,argv[4],strlen(argv[4])); + + smbc_init(auth_fn, 0); + fd = smbc_open(url,O_RDWR | O_CREAT,0666); + smbc_close( fd ); + smbc_rename( url, argv[5] ); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_7.c b/testsuite/libsmbclient/src/rename/rename_7.c new file mode 100644 index 0000000000..67188abea9 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_7.c @@ -0,0 +1,66 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + int fd2 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + smbc_rename( url, argv[5] ); + fd1 = smbc_open( url, O_RDWR, 0666 ); + fd2 = smbc_open( argv[5], O_RDWR, 0666 ); + + if ( fd1 == -1 && fd2 != -1 ) + err = 0; + + else + err = 1; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_8.c b/testsuite/libsmbclient/src/rename/rename_8.c new file mode 100644 index 0000000000..efbef5c30c --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_8.c @@ -0,0 +1,68 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + int fd2 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 7 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[4], strlen(argv[4]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + smbc_mkdir( argv[5], 0666 ); + smbc_rename( url, argv[6] ); + + fd1 = smbc_open( url, O_RDWR, 0666 ); + fd2 = smbc_open( argv[6], O_RDWR, 0666 ); + + if ( fd1 == -1 && fd2 != -1 ) + err = 0; + + else + err = 1; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rename/rename_9.c b/testsuite/libsmbclient/src/rename/rename_9.c new file mode 100644 index 0000000000..1c1876dbb0 --- /dev/null +++ b/testsuite/libsmbclient/src/rename/rename_9.c @@ -0,0 +1,68 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + +#define MAX_BUFF_SIZE 255 +char g_workgroup[MAX_BUFF_SIZE]; +char g_username[MAX_BUFF_SIZE]; +char g_password[MAX_BUFF_SIZE]; +char g_server[MAX_BUFF_SIZE]; +char g_share[MAX_BUFF_SIZE]; + + +void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen, + char *username, int unmaxlen, char *password, int pwmaxlen) +{ + + strncpy(workgroup, g_workgroup, wgmaxlen - 1); + + strncpy(username, g_username, unmaxlen - 1); + + strncpy(password, g_password, pwmaxlen - 1); + + strcpy(g_server, server); + strcpy(g_share, share); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd1 = 0; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 9 ) + { + strncpy( g_workgroup, argv[1], strlen(argv[1]) ); + strncpy( g_username, argv[2], strlen(argv[2]) ); + strncpy( g_password, argv[3], strlen(argv[3]) ); + strncpy( url, argv[6], strlen(argv[6]) ); + + smbc_init( auth_fn, 0 ); + fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 ); + smbc_close( fd1 ); + + smbc_mkdir( argv[7], 0700 ); + + strncpy( g_username, argv[4], strlen(argv[4]) ); + strncpy( g_password, argv[5], strlen(argv[5]) ); + + err = smbc_rename( url, argv[8] ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + |