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 | |
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')
146 files changed, 11354 insertions, 0 deletions
diff --git a/testsuite/libsmbclient/src/Makefile b/testsuite/libsmbclient/src/Makefile new file mode 100644 index 0000000000..a59f134280 --- /dev/null +++ b/testsuite/libsmbclient/src/Makefile @@ -0,0 +1,817 @@ +CC = gcc +CFLAGS = -Wall -W -O2 -g +LFLAGS = -L/root/samba-head-old/source/bin + +LIBS= -L/usr/lib -lsmbclient +INCPATH= -I. -I/usr/include -I./include +BIN_DIR=bin + +SUB_DIRS=init fstat open unlink chown close opendir closedir rename lseek lseekdir stat \ + getdents creat read readdir mkdir rmdir write chmod open_print_job list_print_jobs \ + print_file telldir unlink_print_job + + +G_INIT = $(BIN_DIR)/init_1 \ + $(BIN_DIR)/init_2 \ + $(BIN_DIR)/init_3 \ + $(BIN_DIR)/init_4 + +G_FSTAT = $(BIN_DIR)/fstat_1 \ + $(BIN_DIR)/fstat_2 \ + $(BIN_DIR)/fstat_3 \ + $(BIN_DIR)/fstat_4 \ + $(BIN_DIR)/fstat_5 \ + $(BIN_DIR)/fstat_6 + +G_OPEN = $(BIN_DIR)/open_1 \ + $(BIN_DIR)/open_2 \ + $(BIN_DIR)/open_3 \ + $(BIN_DIR)/open_4 \ + $(BIN_DIR)/open_5 + +G_UNLINK = $(BIN_DIR)/unlink_1 \ + $(BIN_DIR)/unlink_2 \ + $(BIN_DIR)/unlink_3 \ + $(BIN_DIR)/unlink_4 \ + $(BIN_DIR)/unlink_5 \ + $(BIN_DIR)/unlink_6 \ + $(BIN_DIR)/unlink_7 \ + $(BIN_DIR)/unlink_8 \ + $(BIN_DIR)/unlink_9 \ + $(BIN_DIR)/unlink_10 \ + $(BIN_DIR)/unlink_11 \ + $(BIN_DIR)/unlink_12 + + +G_CLOSE = $(BIN_DIR)/close_1 \ + $(BIN_DIR)/close_2 + +G_OPENDIR = $(BIN_DIR)/opendir_1 \ + $(BIN_DIR)/opendir_2 \ + $(BIN_DIR)/opendir_3 \ + $(BIN_DIR)/opendir_4 + +G_CLOSEDIR = $(BIN_DIR)/closedir_1 \ + $(BIN_DIR)/closedir_2 \ + $(BIN_DIR)/closedir_3 \ + $(BIN_DIR)/closedir_4 + +G_RENAME = $(BIN_DIR)/rename_1 \ + $(BIN_DIR)/rename_2 \ + $(BIN_DIR)/rename_3 \ + $(BIN_DIR)/rename_4 \ + $(BIN_DIR)/rename_5 \ + $(BIN_DIR)/rename_6 \ + $(BIN_DIR)/rename_7 \ + $(BIN_DIR)/rename_8 \ + $(BIN_DIR)/rename_9 \ + $(BIN_DIR)/rename_10 \ + $(BIN_DIR)/rename_11 \ + $(BIN_DIR)/rename_12 \ + $(BIN_DIR)/rename_13 \ + $(BIN_DIR)/rename_14 + +G_LSEEK = $(BIN_DIR)/lseek_1 \ + $(BIN_DIR)/lseek_2 \ + $(BIN_DIR)/lseek_3 \ + $(BIN_DIR)/lseek_4 \ + $(BIN_DIR)/lseek_5 \ + $(BIN_DIR)/lseek_6 \ + $(BIN_DIR)/lseek_7 \ + $(BIN_DIR)/lseek_8 + +G_LSEEKDIR = $(BIN_DIR)/lseekdir_1 \ + $(BIN_DIR)/lseekdir_2 \ + $(BIN_DIR)/lseekdir_3 \ + $(BIN_DIR)/lseekdir_4 \ + $(BIN_DIR)/lseekdir_5 \ + $(BIN_DIR)/lseekdir_6 + +G_STAT = $(BIN_DIR)/stat_1 \ + $(BIN_DIR)/stat_2 \ + $(BIN_DIR)/stat_3 \ + $(BIN_DIR)/stat_4 \ + $(BIN_DIR)/stat_5 \ + $(BIN_DIR)/stat_6 + +G_GETDENTS = $(BIN_DIR)/getdents_1 \ + $(BIN_DIR)/getdents_2 \ + $(BIN_DIR)/getdents_3 \ + $(BIN_DIR)/getdents_4 \ + $(BIN_DIR)/getdents_5 + +G_CREAT = $(BIN_DIR)/creat_1 \ + $(BIN_DIR)/creat_2 \ + $(BIN_DIR)/creat_3 + +G_READ = $(BIN_DIR)/read_1 \ + $(BIN_DIR)/read_2 \ + $(BIN_DIR)/read_3 \ + $(BIN_DIR)/read_4 \ + $(BIN_DIR)/read_5 \ + $(BIN_DIR)/read_6 \ + $(BIN_DIR)/read_7 \ + $(BIN_DIR)/read_8 \ + $(BIN_DIR)/read_9 \ + $(BIN_DIR)/read_10 \ + $(BIN_DIR)/read_11 \ + $(BIN_DIR)/read_12 \ + $(BIN_DIR)/read_13 + +G_MKDIR = $(BIN_DIR)/mkdir_1 \ + $(BIN_DIR)/mkdir_2 \ + $(BIN_DIR)/mkdir_3 \ + $(BIN_DIR)/mkdir_4 + +G_RMDIR = $(BIN_DIR)/rmdir_1 \ + $(BIN_DIR)/rmdir_2 \ + $(BIN_DIR)/rmdir_3 \ + $(BIN_DIR)/rmdir_4 \ + $(BIN_DIR)/rmdir_5 \ + $(BIN_DIR)/rmdir_6 + +G_READDIR = $(BIN_DIR)/readdir_1 \ + $(BIN_DIR)/readdir_2 \ + $(BIN_DIR)/readdir_3 \ + $(BIN_DIR)/readdir_4 \ + $(BIN_DIR)/readdir_5 + +G_WRITE = $(BIN_DIR)/write_1 \ + $(BIN_DIR)/write_2 \ + $(BIN_DIR)/write_3 \ + $(BIN_DIR)/write_4 \ + $(BIN_DIR)/write_5 \ + $(BIN_DIR)/write_6 \ + $(BIN_DIR)/write_7 \ + $(BIN_DIR)/write_8 \ + $(BIN_DIR)/write_9 \ + $(BIN_DIR)/write_10 \ + $(BIN_DIR)/write_11 \ + $(BIN_DIR)/write_12 \ + $(BIN_DIR)/write_13 + +G_TELLDIR = $(BIN_DIR)/telldir_1 \ + $(BIN_DIR)/telldir_2 \ + $(BIN_DIR)/telldir_3 \ + $(BIN_DIR)/telldir_4 \ + $(BIN_DIR)/telldir_5 + +G_CHMOD = $(BIN_DIR)/chmod_1 + +G_CHOWN = $(BIN_DIR)/chown_1 + +G_PRINT_FILE = $(BIN_DIR)/print_file_1 \ + $(BIN_DIR)/print_file_2 \ + $(BIN_DIR)/print_file_3 \ + $(BIN_DIR)/print_file_4 + +G_OPEN_PRINT_JOB = $(BIN_DIR)/open_print_job_1 \ + $(BIN_DIR)/open_print_job_2 + +G_LIST_PRINT_JOBS = $(BIN_DIR)/list_print_jobs_1 \ + $(BIN_DIR)/list_print_jobs_2 \ + $(BIN_DIR)/list_print_jobs_3 \ + $(BIN_DIR)/list_print_jobs_4 \ + $(BIN_DIR)/list_print_jobs_5 \ + $(BIN_DIR)/list_print_jobs_6 \ + $(BIN_DIR)/list_print_jobs_7 + +G_UNLINK_PRINT_JOB = $(BIN_DIR)/unlink_print_job_1 \ + $(BIN_DIR)/unlink_print_job_2 \ + $(BIN_DIR)/unlink_print_job_3 \ + $(BIN_DIR)/unlink_print_job_4 \ + $(BIN_DIR)/unlink_print_job_5 + +GROUPS= $(G_CHMOD) $(G_CHOWN) $(G_CLOSE) $(G_CLOSEDIR) $(G_CREAT) $(G_FSTAT)\ + $(G_GETDENTS) $(G_INIT) $(G_LIST_PRINT_JOBS) $(G_LSEEK) $(G_LSEEKDIR) \ + $(G_MKDIR) $(G_OPEN) $(G_OPENDIR) $(G_OPEN_PRINT_JOB) $(G_PRINT_FILE)\ + $(G_READ) $(G_READDIR) $(G_RENAME) $(G_RMDIR) $(G_STAT) $(G_TELLDIR) $(G_UNLINK) \ + $(G_UNLINK_PRINT_JOB) $(G_WRITE) + +.c.o: + @echo Compiling $*.c + @$(CC) -c $(CFLAGS) -o $@ $(INCPATH) $< + + +all: $(GROUPS) + +init: $(G_INIT) +fstat: $(G_FSTAT) +open: $(G_OPEN) +unlink: $(G_UNLINK) +chown: $(G_CHOWN) +close: $(G_CLOSE) +opendir: $(G_OPENDIR) +closedir: $(G_CLOSEDIR) +rename: $(G_RENAME) +readdir: $(G_READDIR) +lseek: $(G_LSEEK) +lseekdir: $(G_LSEEKDIR) +stat: $(G_STAT) +getdents: $(G_GETDENTS) +creat: $(G_CREAT) +read: $(G_READ) +mkdir: $(G_MKDIR) +rmdir: $(G_RMDIR) +write: $(G_WRITE) +chmod: $(G_CHMOD) +telldir: $(G_TELLDIR) +print_file: $(G_PRINT_FILE) +open_print_job: $(G_OPEN_PRINT_JOB) +list_print_jobs: $(G_LIST_PRINT_JOBS) +unlink_print_job: $(G_UNLINK_PRINT_JOB) + + +$(BIN_DIR)/testsmbc: testsmbc.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ testsmbc.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/init_1: init/init_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ init/init_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/init_2: init/init_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ init/init_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/init_3: init/init_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ init/init_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/init_4: init/init_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ init/init_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/fstat_1: fstat/fstat_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ fstat/fstat_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/fstat_2: fstat/fstat_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ fstat/fstat_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/fstat_3: fstat/fstat_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ fstat/fstat_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/fstat_4: fstat/fstat_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ fstat/fstat_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/fstat_5: fstat/fstat_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ fstat/fstat_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/fstat_6: fstat/fstat_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ fstat/fstat_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_1: open/open_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open/open_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_2: open/open_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open/open_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_3: open/open_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open/open_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_4: open/open_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open/open_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_5: open/open_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open/open_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_1: unlink/unlink_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_2: unlink/unlink_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_3: unlink/unlink_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_4: unlink/unlink_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_5: unlink/unlink_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_6: unlink/unlink_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_7: unlink/unlink_7.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_7.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_8: unlink/unlink_8.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_8.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_9: unlink/unlink_9.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_9.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_10: unlink/unlink_10.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_10.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_11: unlink/unlink_11.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_11.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_12: unlink/unlink_12.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink/unlink_12.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/chown_1: chown/chown_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ chown/chown_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/close_1: close/close_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ close/close_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/close_2: close/close_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ close/close_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/opendir_1: opendir/opendir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ opendir/opendir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/opendir_2: opendir/opendir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ opendir/opendir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/opendir_3: opendir/opendir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ opendir/opendir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/opendir_4: opendir/opendir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ opendir/opendir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/closedir_1: closedir/closedir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ closedir/closedir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/closedir_2: closedir/closedir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ closedir/closedir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/closedir_3: closedir/closedir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ closedir/closedir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/closedir_4: closedir/closedir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ closedir/closedir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_1: rename/rename_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_2: rename/rename_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_3: rename/rename_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_4: rename/rename_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_5: rename/rename_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_6: rename/rename_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_7: rename/rename_7.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_7.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_8: rename/rename_8.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_8.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_9: rename/rename_9.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_9.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_10: rename/rename_10.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_10.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_11: rename/rename_11.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_11.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_12: rename/rename_12.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_12.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_13: rename/rename_13.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_13.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rename_14: rename/rename_14.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rename/rename_14.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_1: lseek/lseek_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_2: lseek/lseek_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_3: lseek/lseek_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_4: lseek/lseek_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_5: lseek/lseek_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_6: lseek/lseek_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_7: lseek/lseek_7.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_7.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseek_8: lseek/lseek_8.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseek/lseek_8.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseekdir_1: lseekdir/lseekdir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseekdir/lseekdir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseekdir_2: lseekdir/lseekdir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseekdir/lseekdir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseekdir_3: lseekdir/lseekdir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseekdir/lseekdir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseekdir_4: lseekdir/lseekdir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseekdir/lseekdir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseekdir_5: lseekdir/lseekdir_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseekdir/lseekdir_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/lseekdir_6: lseekdir/lseekdir_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ lseekdir/lseekdir_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/stat_1: stat/stat_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ stat/stat_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/stat_2: stat/stat_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ stat/stat_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/stat_3: stat/stat_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ stat/stat_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/stat_4: stat/stat_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ stat/stat_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/stat_5: stat/stat_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ stat/stat_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/stat_6: stat/stat_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ stat/stat_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/getdents_1: getdents/getdents_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ getdents/getdents_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/getdents_2: getdents/getdents_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ getdents/getdents_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/getdents_3: getdents/getdents_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ getdents/getdents_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/getdents_4: getdents/getdents_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ getdents/getdents_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/getdents_5: getdents/getdents_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ getdents/getdents_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/creat_1: creat/creat_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ creat/creat_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/creat_2: creat/creat_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ creat/creat_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/creat_3: creat/creat_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ creat/creat_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/mkdir_1: mkdir/mkdir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ mkdir/mkdir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/mkdir_2: mkdir/mkdir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ mkdir/mkdir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/mkdir_3: mkdir/mkdir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ mkdir/mkdir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/mkdir_4: mkdir/mkdir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ mkdir/mkdir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/readdir_1: readdir/readdir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ readdir/readdir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/readdir_2: readdir/readdir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ readdir/readdir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/readdir_3: readdir/readdir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ readdir/readdir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/readdir_4: readdir/readdir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ readdir/readdir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/readdir_5: readdir/readdir_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ readdir/readdir_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rmdir_1: rmdir/rmdir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rmdir/rmdir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rmdir_2: rmdir/rmdir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rmdir/rmdir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rmdir_3: rmdir/rmdir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rmdir/rmdir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rmdir_4: rmdir/rmdir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rmdir/rmdir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rmdir_5: rmdir/rmdir_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rmdir/rmdir_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/rmdir_6: rmdir/rmdir_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ rmdir/rmdir_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_1: write/write_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_2: write/write_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_3: write/write_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_4: write/write_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_5: write/write_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_6: write/write_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_7: write/write_7.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_7.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_8: write/write_8.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_8.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_9: write/write_9.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_9.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_10: write/write_10.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_10.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_11: write/write_11.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_11.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_12: write/write_12.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_12.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/write_13: write/write_13.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ write/write_13.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_1: read/read_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_2: read/read_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_3: read/read_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_4: read/read_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_5: read/read_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_6: read/read_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_7: read/read_7.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_7.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_8: read/read_8.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_8.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_9: read/read_9.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_9.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_10: read/read_10.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_10.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_11: read/read_11.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_11.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_12: read/read_12.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_12.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/read_13: read/read_13.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ read/read_13.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/chmod_1: chmod/chmod_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ chmod/chmod_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/telldir_1: telldir/telldir_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ telldir/telldir_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/telldir_2: telldir/telldir_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ telldir/telldir_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/telldir_3: telldir/telldir_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ telldir/telldir_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/telldir_4: telldir/telldir_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ telldir/telldir_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/telldir_5: telldir/telldir_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ telldir/telldir_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/print_file_1: print_file/print_file_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ print_file/print_file_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/print_file_2: print_file/print_file_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ print_file/print_file_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/print_file_3: print_file/print_file_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ print_file/print_file_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/print_file_4: print_file/print_file_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ print_file/print_file_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_print_job_1: open_print_job/open_print_job_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open_print_job/open_print_job_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/open_print_job_2: open_print_job/open_print_job_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ open_print_job/open_print_job_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_1: list_print_jobs/list_print_jobs_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_2: list_print_jobs/list_print_jobs_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_3: list_print_jobs/list_print_jobs_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_4: list_print_jobs/list_print_jobs_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_5: list_print_jobs/list_print_jobs_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_5.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_6: list_print_jobs/list_print_jobs_6.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_6.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/list_print_jobs_7: list_print_jobs/list_print_jobs_7.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ list_print_jobs/list_print_jobs_7.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_print_job_1: unlink_print_job/unlink_print_job_1.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink_print_job/unlink_print_job_1.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_print_job_2: unlink_print_job/unlink_print_job_2.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink_print_job/unlink_print_job_2.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_print_job_3: unlink_print_job/unlink_print_job_3.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink_print_job/unlink_print_job_3.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_print_job_4: unlink_print_job/unlink_print_job_4.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink_print_job/unlink_print_job_4.o $(INCPATH) $(LIBS) + +$(BIN_DIR)/unlink_print_job_5: unlink_print_job/unlink_print_job_5.o + @echo Linking $@ + @$(CC) $(LFLAGS) -o $@ unlink_print_job/unlink_print_job_5.o $(INCPATH) $(LIBS) + + +clean: + @for i in $(SUB_DIRS); do \ + rm -f $$i/*.o; \ + done + + @rm -f $(GROUPS) + @echo "Done" + diff --git a/testsuite/libsmbclient/src/chmod/chmod_1.c b/testsuite/libsmbclient/src/chmod/chmod_1.c new file mode 100644 index 0000000000..47c86b1f80 --- /dev/null +++ b/testsuite/libsmbclient/src/chmod/chmod_1.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 == 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])); + + fd = smbc_init(auth_fn, 0); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/chown/chown_1.c b/testsuite/libsmbclient/src/chown/chown_1.c new file mode 100644 index 0000000000..47c86b1f80 --- /dev/null +++ b/testsuite/libsmbclient/src/chown/chown_1.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 == 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])); + + fd = smbc_init(auth_fn, 0); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/close/close_1.c b/testsuite/libsmbclient/src/close/close_1.c new file mode 100644 index 0000000000..983e627d89 --- /dev/null +++ b/testsuite/libsmbclient/src/close/close_1.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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + err = smbc_close(fd); + + if ( err < 0 ) + err = 1; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/close/close_2.c b/testsuite/libsmbclient/src/close/close_2.c new file mode 100644 index 0000000000..b0319e41d9 --- /dev/null +++ b/testsuite/libsmbclient/src/close/close_2.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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/closedir/closedir_1.c b/testsuite/libsmbclient/src/closedir/closedir_1.c new file mode 100644 index 0000000000..8d27b8ddd8 --- /dev/null +++ b/testsuite/libsmbclient/src/closedir/closedir_1.c @@ -0,0 +1,65 @@ +#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 dh = 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); + smbc_rmdir(url); + smbc_mkdir(url,0666); + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + err = smbc_closedir(dh); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/closedir/closedir_2.c b/testsuite/libsmbclient/src/closedir/closedir_2.c new file mode 100644 index 0000000000..c66cbb9c87 --- /dev/null +++ b/testsuite/libsmbclient/src/closedir/closedir_2.c @@ -0,0 +1,61 @@ +#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 dh = 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); + smbc_rmdir(url); + smbc_mkdir(url,0666); + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + smbc_closedir(dh); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/closedir/closedir_3.c b/testsuite/libsmbclient/src/closedir/closedir_3.c new file mode 100644 index 0000000000..23f5f67971 --- /dev/null +++ b/testsuite/libsmbclient/src/closedir/closedir_3.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 dh = 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); + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + err = smbc_closedir(dh); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/closedir/closedir_4.c b/testsuite/libsmbclient/src/closedir/closedir_4.c new file mode 100644 index 0000000000..bb5dc08331 --- /dev/null +++ b/testsuite/libsmbclient/src/closedir/closedir_4.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 dh = 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); + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + smbc_closedir(dh); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/creat/creat_1.c b/testsuite/libsmbclient/src/creat/creat_1.c new file mode 100644 index 0000000000..9ccab002c1 --- /dev/null +++ b/testsuite/libsmbclient/src/creat/creat_1.c @@ -0,0 +1,60 @@ +#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 == 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); + fd = smbc_creat(url, 0666); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/creat/creat_2.c b/testsuite/libsmbclient/src/creat/creat_2.c new file mode 100644 index 0000000000..599a1845d3 --- /dev/null +++ b/testsuite/libsmbclient/src/creat/creat_2.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 fd = 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + fd = 0; + fd = smbc_creat(url, 0666); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/creat/creat_3.c b/testsuite/libsmbclient/src/creat/creat_3.c new file mode 100644 index 0000000000..ae27a2a1c9 --- /dev/null +++ b/testsuite/libsmbclient/src/creat/creat_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; + int fd = 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); + fd = smbc_creat(url, 0666); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/fstat/fstat_1.c b/testsuite/libsmbclient/src/fstat/fstat_1.c new file mode 100644 index 0000000000..fd63400869 --- /dev/null +++ b/testsuite/libsmbclient/src/fstat/fstat_1.c @@ -0,0 +1,62 @@ +#include <stdio.h> +#include <stdlib.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; + struct stat st; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + smbc_init(auth_fn, 0); + + fd = 11234; + err = smbc_fstat(fd,&st); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/fstat/fstat_2.c b/testsuite/libsmbclient/src/fstat/fstat_2.c new file mode 100644 index 0000000000..ea2e7e3145 --- /dev/null +++ b/testsuite/libsmbclient/src/fstat/fstat_2.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <stdlib.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; + struct stat st; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + smbc_init(auth_fn, 0); + + fd = 11234; + smbc_fstat(fd,&st); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/fstat/fstat_3.c b/testsuite/libsmbclient/src/fstat/fstat_3.c new file mode 100644 index 0000000000..57bb3b7557 --- /dev/null +++ b/testsuite/libsmbclient/src/fstat/fstat_3.c @@ -0,0 +1,69 @@ +#include <stdio.h> +#include <stdlib.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]; + struct stat st; + + 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); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + + err = smbc_fstat(fd, &st); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/fstat/fstat_4.c b/testsuite/libsmbclient/src/fstat/fstat_4.c new file mode 100644 index 0000000000..57bb3b7557 --- /dev/null +++ b/testsuite/libsmbclient/src/fstat/fstat_4.c @@ -0,0 +1,69 @@ +#include <stdio.h> +#include <stdlib.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]; + struct stat st; + + 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); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + + err = smbc_fstat(fd, &st); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/fstat/fstat_5.c b/testsuite/libsmbclient/src/fstat/fstat_5.c new file mode 100644 index 0000000000..9ebdd60264 --- /dev/null +++ b/testsuite/libsmbclient/src/fstat/fstat_5.c @@ -0,0 +1,77 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + struct stat st; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + + smbc_fstat(fd,&st); + + smbc_close(fd); + free(message); + + if ( st.st_size != msg_len ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/fstat/fstat_6.c b/testsuite/libsmbclient/src/fstat/fstat_6.c new file mode 100644 index 0000000000..a570c0adbc --- /dev/null +++ b/testsuite/libsmbclient/src/fstat/fstat_6.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + unsigned int mode_mask = 0; + char url[MAX_BUFF_SIZE]; + char* message; + struct stat st; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + + smbc_fstat(fd,&st); + + smbc_close(fd); + free(message); + + mode_mask = mode_mask | S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; //0666 or 33206 + + if ( st.st_mode != mode_mask ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/getdents/getdents_1.c b/testsuite/libsmbclient/src/getdents/getdents_1.c new file mode 100644 index 0000000000..96fa45cc10 --- /dev/null +++ b/testsuite/libsmbclient/src/getdents/getdents_1.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <stdlib.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 dh = 0; + //int dirsize = 0; + //int dircount = 0; + + struct smbc_dirent *dirptr; + + char url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + dh = smbc_opendir(url); + err = smbc_getdents( dh, dirptr, sizeof(dirbuff)); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/getdents/getdents_2.c b/testsuite/libsmbclient/src/getdents/getdents_2.c new file mode 100644 index 0000000000..9d9d5b0b18 --- /dev/null +++ b/testsuite/libsmbclient/src/getdents/getdents_2.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdlib.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 dh = 0; + //int dirsize = 0; + //int dircount = 0; + + struct smbc_dirent *dirptr; + + char url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + dh = smbc_opendir(url); + err = smbc_getdents( dh, dirptr, sizeof(dirbuff)); + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/getdents/getdents_3.c b/testsuite/libsmbclient/src/getdents/getdents_3.c new file mode 100644 index 0000000000..aa22caa4d4 --- /dev/null +++ b/testsuite/libsmbclient/src/getdents/getdents_3.c @@ -0,0 +1,155 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + int j = 0; + char *file_name; + char *tmp_file_ptr; + int direntsize = 0; + int diramount = 0; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + diramount = smbc_getdents( dh, dirptr, sizeof(dirbuff)); + + err = 0; + i = 0; + bzero(buff,MAX_BUFF_SIZE); + bzero(tmp_file_ptr,MAX_BUFF_SIZE-9); + + while ( diramount > 0 ) + { + direntsize = dirptr->dirlen; + //printf("Name: %s\n",dirptr->name); + if ( j == 0 ) + { + if ( !(( strncmp(dirptr->name,".",1) == 0 )) ) + { + break; + err = 1; + } + + } else if ( j == 1 ) { + + if ( !(( strncmp(dirptr->name,"..",2) == 0 )) ) + { + break; + err = 1; + } + + } else if ( j > 1 ) { + + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + + if ( !(( strcmp(dirptr->name,file_url) == 0 )) ) // make sure entries match + { + err = 1; + break; + } + + i++; + + } + + (char *)dirptr += direntsize; + (char *)diramount -= direntsize; + j++; + + } + + if ( ! err ) + { + if ( (j - 2) != entry_num ) // Make sure that all entries created are counted and returned - minus . and .. + err = 1; + } + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/getdents/getdents_4.c b/testsuite/libsmbclient/src/getdents/getdents_4.c new file mode 100644 index 0000000000..4afd3539b8 --- /dev/null +++ b/testsuite/libsmbclient/src/getdents/getdents_4.c @@ -0,0 +1,101 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + int diramount = 0; + + struct smbc_dirent *dirptr; + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + diramount = smbc_getdents( dh, dirptr, 20 /*sizeof(dirbuff)*/ ); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/getdents/getdents_5.c b/testsuite/libsmbclient/src/getdents/getdents_5.c new file mode 100644 index 0000000000..5cf7c1b928 --- /dev/null +++ b/testsuite/libsmbclient/src/getdents/getdents_5.c @@ -0,0 +1,106 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + int diramount = 0; + + struct smbc_dirent *dirptr; + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + diramount = smbc_getdents( dh, dirptr, 20 /* sizeof(dirbuff)*/); + + if ( diramount < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/init/init_1.c b/testsuite/libsmbclient/src/init/init_1.c new file mode 100644 index 0000000000..bc928ac3d5 --- /dev/null +++ b/testsuite/libsmbclient/src/init/init_1.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + + +int main() +{ + int err = -1; + + err = smbc_init(NULL, 0); + + if ( err < 0 ) + err = 1; + + return err; + +} diff --git a/testsuite/libsmbclient/src/init/init_2.c b/testsuite/libsmbclient/src/init/init_2.c new file mode 100644 index 0000000000..120160297b --- /dev/null +++ b/testsuite/libsmbclient/src/init/init_2.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + + +int main(int argc, char **argv ) +{ + int err = -1; + + if ( argc > 1 ) + { + err = smbc_init(NULL, atoi(argv[1])); + + if ( err < 0 ) + err = 1; + + } + + return err; + +} diff --git a/testsuite/libsmbclient/src/init/init_3.c b/testsuite/libsmbclient/src/init/init_3.c new file mode 100644 index 0000000000..f49ed982e1 --- /dev/null +++ b/testsuite/libsmbclient/src/init/init_3.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <stdlib.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 == 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])); + + err = smbc_init(auth_fn, atoi(argv[4])); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/init/init_4.c b/testsuite/libsmbclient/src/init/init_4.c new file mode 100644 index 0000000000..d8e44b50ee --- /dev/null +++ b/testsuite/libsmbclient/src/init/init_4.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <libsmbclient.h> + + +int main( ) +{ + int err = -1; + + err = smbc_init(NULL, 0); + + err = errno; + + return err; + +} diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_1.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_1.c new file mode 100644 index 0000000000..f12fcb48c6 --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_1.c @@ -0,0 +1,109 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_size; + +int call_back_flag; +int print_queue_empty; + +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); + +} + +void print_list_fn_2(struct print_job_info *pji) +{ + print_queue_empty = 0; + g_print_id = pji->id; +} + +void print_list_fn(struct print_job_info *pji) +{ + + call_back_flag = 1; + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +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); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + call_back_flag = 0; + print_queue_empty = 0; + + 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); + + while ( ! print_queue_empty ) // Wait until the queue is empty + { + sleep(1); + print_queue_empty = 1; + smbc_list_print_jobs(url,print_list_fn_2); + } + + smbc_list_print_jobs(url,print_list_fn); + + if ( call_back_flag ) + + err = 0; + + else + err = 1; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_2.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_2.c new file mode 100644 index 0000000000..faa60cd31b --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_2.c @@ -0,0 +1,105 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_size; + +int print_queue_empty; + +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); + +} + +void print_list_fn_2(struct print_job_info *pji) +{ + print_queue_empty = 0; + g_print_id = pji->id; +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +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); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + print_queue_empty = 0; + + 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); + + while ( ! print_queue_empty ) // Wait until the queue is empty + { + sleep(1); + print_queue_empty = 1; + smbc_list_print_jobs(url,print_list_fn_2); + } + + err = smbc_list_print_jobs(url,print_list_fn); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_3.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_3.c new file mode 100644 index 0000000000..c08240d1d5 --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_3.c @@ -0,0 +1,103 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + err = smbc_list_print_jobs(argv[6],print_list_fn); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_4.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_4.c new file mode 100644 index 0000000000..89234b358f --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_4.c @@ -0,0 +1,99 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + err = smbc_list_print_jobs(argv[6],print_list_fn); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_5.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_5.c new file mode 100644 index 0000000000..fa0007f7a5 --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_5.c @@ -0,0 +1,101 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_size; + +int print_queue_empty; + +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); + +} + +void print_list_fn_2(struct print_job_info *pji) +{ + print_queue_empty = 0; + g_print_id = pji->id; +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +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); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + print_queue_empty = 0; + + 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); + + while ( ! print_queue_empty ) // Wait until the queue is empty + { + sleep(1); + print_queue_empty = 1; + smbc_list_print_jobs(url,print_list_fn_2); + } + + smbc_list_print_jobs(url,print_list_fn); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_6.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_6.c new file mode 100644 index 0000000000..d752d0d0ab --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_6.c @@ -0,0 +1,110 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_size; + +int print_fn_call_flag; + +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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + + + print_fn_call_flag = 1; + +} + +int main(int argc, char** argv) +{ + + int err = -1; + int fd = 0; + int msg_len = 0; + char * message; + char url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + print_fn_call_flag = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + smbc_list_print_jobs(url,print_list_fn); + + if ( print_fn_call_flag == 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_7.c b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_7.c new file mode 100644 index 0000000000..2675e12d9d --- /dev/null +++ b/testsuite/libsmbclient/src/list_print_jobs/list_print_jobs_7.c @@ -0,0 +1,106 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + smbc_print_file(url,argv[6]); + smbc_list_print_jobs(argv[6],print_list_fn); + + + if (( (g_print_size > 0) && (g_print_size > 0) && (strcasecmp(g_username,g_print_user)==0) )) + // && (strlen(g_print_name) > 0) )) + err = 0; + + else + err = 1; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_1.c b/testsuite/libsmbclient/src/lseek/lseek_1.c new file mode 100644 index 0000000000..c358565d31 --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_1.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <stdlib.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; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + smbc_init(auth_fn, 0); + + fd = -1; + err = smbc_lseek(fd, 0, SEEK_SET); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_2.c b/testsuite/libsmbclient/src/lseek/lseek_2.c new file mode 100644 index 0000000000..8b58ade083 --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_2.c @@ -0,0 +1,57 @@ +#include <stdio.h> +#include <stdlib.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; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + smbc_init(auth_fn, 0); + + fd = -1; + smbc_lseek(fd, 0, SEEK_SET); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_3.c b/testsuite/libsmbclient/src/lseek/lseek_3.c new file mode 100644 index 0000000000..c8a62e682b --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_3.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_lseek(fd,msg_len,SEEK_SET); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + free(message); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_4.c b/testsuite/libsmbclient/src/lseek/lseek_4.c new file mode 100644 index 0000000000..c8a62e682b --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_4.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_lseek(fd,msg_len,SEEK_SET); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + free(message); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_5.c b/testsuite/libsmbclient/src/lseek/lseek_5.c new file mode 100644 index 0000000000..2e40c96410 --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_5.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_lseek(fd,msg_len,SEEK_SET); + smbc_close(fd); + + if ( err != msg_len ) + err = 1; + + else + err = 0; + + free(message); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_6.c b/testsuite/libsmbclient/src/lseek/lseek_6.c new file mode 100644 index 0000000000..b5236b8537 --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_6.c @@ -0,0 +1,75 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_lseek(fd,msg_len,SEEK_SET); + err = errno; + smbc_close(fd); + + free(message); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_7.c b/testsuite/libsmbclient/src/lseek/lseek_7.c new file mode 100644 index 0000000000..e3ef6cdd54 --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_7.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_lseek(fd,0,SEEK_END); + smbc_close(fd); + + if ( err != msg_len ) + err = 1; + + else + err = 0; + + free(message); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseek/lseek_8.c b/testsuite/libsmbclient/src/lseek/lseek_8.c new file mode 100644 index 0000000000..e70f3ca6b5 --- /dev/null +++ b/testsuite/libsmbclient/src/lseek/lseek_8.c @@ -0,0 +1,75 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_lseek(fd,0,SEEK_END); + err = errno; + smbc_close(fd); + + free(message); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseekdir/lseekdir_1.c b/testsuite/libsmbclient/src/lseekdir/lseekdir_1.c new file mode 100644 index 0000000000..1c1ffa330e --- /dev/null +++ b/testsuite/libsmbclient/src/lseekdir/lseekdir_1.c @@ -0,0 +1,102 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + err = smbc_lseekdir(dh,0); + //printf("err: %i\n",err); + + if ( err < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseekdir/lseekdir_2.c b/testsuite/libsmbclient/src/lseekdir/lseekdir_2.c new file mode 100644 index 0000000000..cb729d8642 --- /dev/null +++ b/testsuite/libsmbclient/src/lseekdir/lseekdir_2.c @@ -0,0 +1,95 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + smbc_lseekdir(dh,0); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseekdir/lseekdir_3.c b/testsuite/libsmbclient/src/lseekdir/lseekdir_3.c new file mode 100644 index 0000000000..eae8c63b77 --- /dev/null +++ b/testsuite/libsmbclient/src/lseekdir/lseekdir_3.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdlib.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 dh = 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); + + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + err = smbc_lseekdir(dh,0); + //printf("err: %i\n",err); + + if ( err < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseekdir/lseekdir_4.c b/testsuite/libsmbclient/src/lseekdir/lseekdir_4.c new file mode 100644 index 0000000000..ac21616340 --- /dev/null +++ b/testsuite/libsmbclient/src/lseekdir/lseekdir_4.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <stdlib.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 dh = 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); + + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + smbc_lseekdir(dh,0); + err = errno; + //printf("err: %i\n",err); + + + } + + return err; + +} diff --git a/testsuite/libsmbclient/src/lseekdir/lseekdir_5.c b/testsuite/libsmbclient/src/lseekdir/lseekdir_5.c new file mode 100644 index 0000000000..08af806f5f --- /dev/null +++ b/testsuite/libsmbclient/src/lseekdir/lseekdir_5.c @@ -0,0 +1,119 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + int dirsize = 0; + char *file_name; + char *tmp_file_ptr; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + err = 0; + + while ( 1 ) + { + dirptr = smbc_readdir(dh); + + if ( dirptr == NULL ) + { + break; + } + + (char*)dirsize += dirptr->dirlen; + + } + + smbc_lseekdir(dh,0); + err = smbc_telldir(dh); + + if ( err != 0 ) + err = 1; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/lseekdir/lseekdir_6.c b/testsuite/libsmbclient/src/lseekdir/lseekdir_6.c new file mode 100644 index 0000000000..94c86e26eb --- /dev/null +++ b/testsuite/libsmbclient/src/lseekdir/lseekdir_6.c @@ -0,0 +1,124 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + int offset = 0; + int dirsize = 0; + char *file_name; + char *tmp_file_ptr; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + err = 0; + + while ( 1 ) + { + dirptr = smbc_readdir(dh); + + if ( dirptr == NULL ) + { + break; + } + + (char*)dirsize += dirptr->dirlen; + + } + + smbc_lseekdir(dh,0); // move to front + smbc_lseekdir(dh,dirsize); // move to end + offset = smbc_telldir(dh); + + if ( offset != dirsize ) + { + //printf("offset: %i dirsize: %i\n",offset,dirsize); + err = 1; + } + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/mkdir/mkdir_1.c b/testsuite/libsmbclient/src/mkdir/mkdir_1.c new file mode 100644 index 0000000000..20389bcb9b --- /dev/null +++ b/testsuite/libsmbclient/src/mkdir/mkdir_1.c @@ -0,0 +1,60 @@ +#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 == 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 ); + smbc_rmdir( url ); + err = smbc_mkdir( url, 0666 ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/mkdir/mkdir_2.c b/testsuite/libsmbclient/src/mkdir/mkdir_2.c new file mode 100644 index 0000000000..ebbc94a18b --- /dev/null +++ b/testsuite/libsmbclient/src/mkdir/mkdir_2.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 == 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 ); + smbc_rmdir( url ); + smbc_mkdir( url, 0666 ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/mkdir/mkdir_3.c b/testsuite/libsmbclient/src/mkdir/mkdir_3.c new file mode 100644 index 0000000000..e5a0ce2561 --- /dev/null +++ b/testsuite/libsmbclient/src/mkdir/mkdir_3.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; + 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 ); + smbc_rmdir( url ); + + smbc_mkdir( url, 0666 ); + smbc_mkdir( url, 0666 ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/mkdir/mkdir_4.c b/testsuite/libsmbclient/src/mkdir/mkdir_4.c new file mode 100644 index 0000000000..ed1aa70f33 --- /dev/null +++ b/testsuite/libsmbclient/src/mkdir/mkdir_4.c @@ -0,0 +1,62 @@ +#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 == 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 ); + smbc_rmdir( url ); + + smbc_mkdir( url, 0666 ); + err = smbc_mkdir( url, 0666 ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open/open_1.c b/testsuite/libsmbclient/src/open/open_1.c new file mode 100644 index 0000000000..9f72985cec --- /dev/null +++ b/testsuite/libsmbclient/src/open/open_1.c @@ -0,0 +1,60 @@ +#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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open/open_2.c b/testsuite/libsmbclient/src/open/open_2.c new file mode 100644 index 0000000000..8903ee912b --- /dev/null +++ b/testsuite/libsmbclient/src/open/open_2.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; + int fd = 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open/open_3.c b/testsuite/libsmbclient/src/open/open_3.c new file mode 100644 index 0000000000..25a663d6ab --- /dev/null +++ b/testsuite/libsmbclient/src/open/open_3.c @@ -0,0 +1,60 @@ +#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 == 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); + fd = smbc_open(url, O_RDWR, 0666); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open/open_4.c b/testsuite/libsmbclient/src/open/open_4.c new file mode 100644 index 0000000000..2bfe30f1af --- /dev/null +++ b/testsuite/libsmbclient/src/open/open_4.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 fd = 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + fd = 0; + fd = smbc_open(url, O_RDWR, 0666); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open/open_5.c b/testsuite/libsmbclient/src/open/open_5.c new file mode 100644 index 0000000000..93ffb4891e --- /dev/null +++ b/testsuite/libsmbclient/src/open/open_5.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 fd = 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + fd = smbc_open(url, O_RDWR, 0666); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open_print_job/open_print_job_1.c b/testsuite/libsmbclient/src/open_print_job/open_print_job_1.c new file mode 100644 index 0000000000..585fdee377 --- /dev/null +++ b/testsuite/libsmbclient/src/open_print_job/open_print_job_1.c @@ -0,0 +1,60 @@ +#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 == 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); + fd = smbc_open_print_job(url); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/open_print_job/open_print_job_2.c b/testsuite/libsmbclient/src/open_print_job/open_print_job_2.c new file mode 100644 index 0000000000..f737f19bfe --- /dev/null +++ b/testsuite/libsmbclient/src/open_print_job/open_print_job_2.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; + int fd = 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); + fd = smbc_open_print_job(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/opendir/opendir_1.c b/testsuite/libsmbclient/src/opendir/opendir_1.c new file mode 100644 index 0000000000..e839b99cd1 --- /dev/null +++ b/testsuite/libsmbclient/src/opendir/opendir_1.c @@ -0,0 +1,62 @@ +#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 dh = 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); + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + + if ( dh < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/opendir/opendir_2.c b/testsuite/libsmbclient/src/opendir/opendir_2.c new file mode 100644 index 0000000000..60658d2cd5 --- /dev/null +++ b/testsuite/libsmbclient/src/opendir/opendir_2.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 == 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); + smbc_opendir(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/opendir/opendir_3.c b/testsuite/libsmbclient/src/opendir/opendir_3.c new file mode 100644 index 0000000000..3b6f28eaf3 --- /dev/null +++ b/testsuite/libsmbclient/src/opendir/opendir_3.c @@ -0,0 +1,65 @@ +#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 == 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); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR|O_CREAT,0666); + smbc_close(fd); + + err = smbc_opendir(url); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/opendir/opendir_4.c b/testsuite/libsmbclient/src/opendir/opendir_4.c new file mode 100644 index 0000000000..23b25e5506 --- /dev/null +++ b/testsuite/libsmbclient/src/opendir/opendir_4.c @@ -0,0 +1,61 @@ +#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 == 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); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR|O_CREAT,0666); + smbc_close(fd); + + smbc_opendir(url); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/print_file/print_file_1.c b/testsuite/libsmbclient/src/print_file/print_file_1.c new file mode 100644 index 0000000000..fcb4466112 --- /dev/null +++ b/testsuite/libsmbclient/src/print_file/print_file_1.c @@ -0,0 +1,76 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + err = smbc_print_file(url,argv[6]); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/print_file/print_file_2.c b/testsuite/libsmbclient/src/print_file/print_file_2.c new file mode 100644 index 0000000000..a217a0f3b4 --- /dev/null +++ b/testsuite/libsmbclient/src/print_file/print_file_2.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + smbc_print_file(url,argv[6]); + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/print_file/print_file_3.c b/testsuite/libsmbclient/src/print_file/print_file_3.c new file mode 100644 index 0000000000..4b2a6af84f --- /dev/null +++ b/testsuite/libsmbclient/src/print_file/print_file_3.c @@ -0,0 +1,59 @@ +#include <stdio.h> +#include <stdlib.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_print_file(url,argv[6]); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} diff --git a/testsuite/libsmbclient/src/print_file/print_file_4.c b/testsuite/libsmbclient/src/print_file/print_file_4.c new file mode 100644 index 0000000000..1650f7340d --- /dev/null +++ b/testsuite/libsmbclient/src/print_file/print_file_4.c @@ -0,0 +1,55 @@ +#include <stdio.h> +#include <stdlib.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_print_file(url,argv[6]); + + err = errno; + + } + + return err; + +} diff --git a/testsuite/libsmbclient/src/read/read_1.c b/testsuite/libsmbclient/src/read/read_1.c new file mode 100644 index 0000000000..accf0bf872 --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_1.c @@ -0,0 +1,83 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url,O_RDWR, 0666); + err = smbc_read(fd,response,msg_len); + + free(message); + free(response); + + if ( err < 0 ) + err = 1; + + else if ( err != msg_len ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_10.c b/testsuite/libsmbclient/src/read/read_10.c new file mode 100644 index 0000000000..d5b66dfe63 --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_10.c @@ -0,0 +1,68 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message = NULL; + + 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); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + msg_len = 10; + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + + err = errno; + + smbc_close(fd); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_11.c b/testsuite/libsmbclient/src/read/read_11.c new file mode 100644 index 0000000000..3f9ae3f97d --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_11.c @@ -0,0 +1,83 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDONLY, 0666); + smbc_read(fd,response,msg_len); + smbc_close(fd); + + if ( memcmp ( message, response, msg_len) == 0 ) + err = 0; + + else + err = 1; + + free(message); + free(response); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_12.c b/testsuite/libsmbclient/src/read/read_12.c new file mode 100644 index 0000000000..2747f62e1c --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_12.c @@ -0,0 +1,87 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + strncpy(g_username,"xxxxxxxx",8); + strncpy(g_password,"xxxxxxxx",8); + + fd = smbc_open(url, O_RDONLY, 0666); + + err = smbc_read(fd,response,msg_len); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + free(message); + free(response); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_13.c b/testsuite/libsmbclient/src/read/read_13.c new file mode 100644 index 0000000000..89bc68f915 --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_13.c @@ -0,0 +1,91 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + strncpy(g_username,"xxxxxxxx",8); + strncpy(g_password,"xxxxxxxx",8); + + fd = smbc_open(url, O_RDONLY, 0666); + + if (fd < 0) + + err = errno; + + else { + + err = smbc_read(fd,response,msg_len); + err = errno; + + smbc_close(fd); + + } + + free(message); + free(response); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_2.c b/testsuite/libsmbclient/src/read/read_2.c new file mode 100644 index 0000000000..4b3dc9439c --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_2.c @@ -0,0 +1,76 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url,O_RDWR, 0666); + smbc_read(fd,response,msg_len); + err = errno; + + free(message); + free(response); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_3.c b/testsuite/libsmbclient/src/read/read_3.c new file mode 100644 index 0000000000..3f4493487e --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_3.c @@ -0,0 +1,83 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url,O_WRONLY, 0666); + err = smbc_read(fd,response,msg_len); + + free(message); + free(response); + + if ( err < 0 ) + err = 1; + + else if ( err != msg_len ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_4.c b/testsuite/libsmbclient/src/read/read_4.c new file mode 100644 index 0000000000..dbacfa392e --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_4.c @@ -0,0 +1,77 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + bzero(response,msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url,O_WRONLY, 0666); + smbc_read(fd,response,msg_len); + err = errno; + + free(message); + free(response); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_5.c b/testsuite/libsmbclient/src/read/read_5.c new file mode 100644 index 0000000000..96891ef8da --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_5.c @@ -0,0 +1,83 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url,O_RDONLY, 0666); + err = smbc_read(fd,response,msg_len); + + free(message); + free(response); + + if ( err < 0 ) + err = 1; + + else if ( err != msg_len ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_6.c b/testsuite/libsmbclient/src/read/read_6.c new file mode 100644 index 0000000000..7839a964ee --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_6.c @@ -0,0 +1,77 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + bzero(response,msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url,O_RDONLY, 0666); + smbc_read(fd,response,msg_len); + err = errno; + + free(message); + free(response); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_7.c b/testsuite/libsmbclient/src/read/read_7.c new file mode 100644 index 0000000000..081b50a3c8 --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_7.c @@ -0,0 +1,60 @@ +#include <stdio.h> +#include <stdlib.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* message = "Testing"; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + fd = 10345; // Random value for File Descriptor + smbc_init(auth_fn, 0); + err = smbc_read(fd, message, sizeof(message)); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_8.c b/testsuite/libsmbclient/src/read/read_8.c new file mode 100644 index 0000000000..5523fbaac3 --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_8.c @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <stdlib.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* message = "Testing"; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + fd = 10345; // Random value for File Descriptor + smbc_init(auth_fn, 0); + err = smbc_read(fd, message, sizeof(message)); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/read/read_9.c b/testsuite/libsmbclient/src/read/read_9.c new file mode 100644 index 0000000000..77468317d9 --- /dev/null +++ b/testsuite/libsmbclient/src/read/read_9.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message = NULL; + + 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); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + msg_len = 10; + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_read(fd, message, msg_len); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/readdir/readdir_1.c b/testsuite/libsmbclient/src/readdir/readdir_1.c new file mode 100644 index 0000000000..5ca7e38bf8 --- /dev/null +++ b/testsuite/libsmbclient/src/readdir/readdir_1.c @@ -0,0 +1,107 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + dirptr = smbc_readdir( dh ); + + if ( dirptr == NULL ) + + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/readdir/readdir_2.c b/testsuite/libsmbclient/src/readdir/readdir_2.c new file mode 100644 index 0000000000..bc4f53dd85 --- /dev/null +++ b/testsuite/libsmbclient/src/readdir/readdir_2.c @@ -0,0 +1,102 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + dirptr = smbc_readdir( dh ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/readdir/readdir_3.c b/testsuite/libsmbclient/src/readdir/readdir_3.c new file mode 100644 index 0000000000..06a4c9eded --- /dev/null +++ b/testsuite/libsmbclient/src/readdir/readdir_3.c @@ -0,0 +1,71 @@ +#include <stdio.h> +#include <stdlib.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 dh = 0; + + struct smbc_dirent *dirptr; + + + char url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + dh = smbc_opendir(url); + dirptr = smbc_readdir( dh ); + + if ( dirptr == NULL ) + + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/readdir/readdir_4.c b/testsuite/libsmbclient/src/readdir/readdir_4.c new file mode 100644 index 0000000000..42b18aaa48 --- /dev/null +++ b/testsuite/libsmbclient/src/readdir/readdir_4.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdlib.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 dh = 0; + + struct smbc_dirent *dirptr; + + + char url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + + if ( argc == 5 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + + dh = smbc_opendir(url); + dirptr = smbc_readdir( dh ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/readdir/readdir_5.c b/testsuite/libsmbclient/src/readdir/readdir_5.c new file mode 100644 index 0000000000..d1a31ef9f0 --- /dev/null +++ b/testsuite/libsmbclient/src/readdir/readdir_5.c @@ -0,0 +1,155 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + int j = 0; + char *file_name; + char *tmp_file_ptr; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + + err = 0; + i = 0; + bzero(buff,MAX_BUFF_SIZE); + bzero(tmp_file_ptr,MAX_BUFF_SIZE-9); + + while ( 1 ) + { + dirptr = smbc_readdir( dh ); + if ( dirptr == NULL ) + { + break; + } + + //printf("Name: %s\n",dirptr->name); + if ( j == 0 ) + { + if ( !(( strncmp(dirptr->name,".",1) == 0 )) ) + { + break; + err = 1; + } + + } else if ( j == 1 ) { + + if ( !(( strncmp(dirptr->name,"..",2) == 0 )) ) + { + break; + err = 1; + } + + } else if ( j > 1 ) { + + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + + if ( !(( strcmp(dirptr->name,file_url) == 0 )) ) // make sure entries match + { + err = 1; + break; + } + + i++; + + } + + j++; + + } + + if ( ! err ) + { + if ( (j - 2) != entry_num ) // Make sure that all entries created are counted and returned - minus . and .. + err = 1; + } + + } + + return err; + +} + 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; + +} + diff --git a/testsuite/libsmbclient/src/rmdir/rmdir_1.c b/testsuite/libsmbclient/src/rmdir/rmdir_1.c new file mode 100644 index 0000000000..2c64052d8b --- /dev/null +++ b/testsuite/libsmbclient/src/rmdir/rmdir_1.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; + 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 ); + err = smbc_rmdir( url ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rmdir/rmdir_2.c b/testsuite/libsmbclient/src/rmdir/rmdir_2.c new file mode 100644 index 0000000000..700b1d7a97 --- /dev/null +++ b/testsuite/libsmbclient/src/rmdir/rmdir_2.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 == 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 ); + smbc_rmdir( url ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rmdir/rmdir_3.c b/testsuite/libsmbclient/src/rmdir/rmdir_3.c new file mode 100644 index 0000000000..c1b881d4d4 --- /dev/null +++ b/testsuite/libsmbclient/src/rmdir/rmdir_3.c @@ -0,0 +1,61 @@ +#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 == 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 ); + smbc_mkdir( url, 700 ); + + err = smbc_rmdir( url ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rmdir/rmdir_4.c b/testsuite/libsmbclient/src/rmdir/rmdir_4.c new file mode 100644 index 0000000000..a772303725 --- /dev/null +++ b/testsuite/libsmbclient/src/rmdir/rmdir_4.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 == 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 ); + smbc_mkdir( url, 700 ); + + smbc_rmdir( url ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rmdir/rmdir_5.c b/testsuite/libsmbclient/src/rmdir/rmdir_5.c new file mode 100644 index 0000000000..c4f787f63b --- /dev/null +++ b/testsuite/libsmbclient/src/rmdir/rmdir_5.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_rmdir( url ); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/rmdir/rmdir_6.c b/testsuite/libsmbclient/src/rmdir/rmdir_6.c new file mode 100644 index 0000000000..a44e677832 --- /dev/null +++ b/testsuite/libsmbclient/src/rmdir/rmdir_6.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 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_rmdir( url ); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/stat/stat_1.c b/testsuite/libsmbclient/src/stat/stat_1.c new file mode 100644 index 0000000000..08382acd74 --- /dev/null +++ b/testsuite/libsmbclient/src/stat/stat_1.c @@ -0,0 +1,62 @@ +#include <stdio.h> +#include <stdlib.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]; + struct stat st; + + 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); + err = smbc_stat(url, &st); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/stat/stat_2.c b/testsuite/libsmbclient/src/stat/stat_2.c new file mode 100644 index 0000000000..80ee5dd871 --- /dev/null +++ b/testsuite/libsmbclient/src/stat/stat_2.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <stdlib.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]; + struct stat st; + + 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); + smbc_stat(url, &st); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/stat/stat_3.c b/testsuite/libsmbclient/src/stat/stat_3.c new file mode 100644 index 0000000000..1220577a3c --- /dev/null +++ b/testsuite/libsmbclient/src/stat/stat_3.c @@ -0,0 +1,66 @@ +#include <stdio.h> +#include <stdlib.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]; + struct stat st; + + 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); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + err = smbc_stat(url, &st); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/stat/stat_4.c b/testsuite/libsmbclient/src/stat/stat_4.c new file mode 100644 index 0000000000..8bc544833e --- /dev/null +++ b/testsuite/libsmbclient/src/stat/stat_4.c @@ -0,0 +1,62 @@ +#include <stdio.h> +#include <stdlib.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]; + struct stat st; + + 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); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + smbc_stat(url, &st); + + err = errno; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/stat/stat_5.c b/testsuite/libsmbclient/src/stat/stat_5.c new file mode 100644 index 0000000000..86028f0598 --- /dev/null +++ b/testsuite/libsmbclient/src/stat/stat_5.c @@ -0,0 +1,77 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + struct stat st; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + smbc_stat(url,&st); + + free(message); + + if ( st.st_size != msg_len ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/stat/stat_6.c b/testsuite/libsmbclient/src/stat/stat_6.c new file mode 100644 index 0000000000..a27e9ba139 --- /dev/null +++ b/testsuite/libsmbclient/src/stat/stat_6.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + unsigned int mode_mask = 0; + char url[MAX_BUFF_SIZE]; + char* message; + struct stat st; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + smbc_stat(url,&st); + + free(message); + + mode_mask = mode_mask | S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; //0666 or 33206 + + if ( st.st_mode != mode_mask ) + err = 1; + + else + err = 0; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/telldir/telldir_1.c b/testsuite/libsmbclient/src/telldir/telldir_1.c new file mode 100644 index 0000000000..401bae9e16 --- /dev/null +++ b/testsuite/libsmbclient/src/telldir/telldir_1.c @@ -0,0 +1,102 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + err = smbc_telldir(dh); + //printf("err: %i\n",err); + + if ( err < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/telldir/telldir_2.c b/testsuite/libsmbclient/src/telldir/telldir_2.c new file mode 100644 index 0000000000..6971b79b0f --- /dev/null +++ b/testsuite/libsmbclient/src/telldir/telldir_2.c @@ -0,0 +1,95 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + char *file_name; + char *tmp_file_ptr; + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + smbc_telldir(dh); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/telldir/telldir_3.c b/testsuite/libsmbclient/src/telldir/telldir_3.c new file mode 100644 index 0000000000..18f1aac695 --- /dev/null +++ b/testsuite/libsmbclient/src/telldir/telldir_3.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdlib.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 dh = 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); + + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + err = smbc_telldir(dh); + //printf("err: %i\n",err); + + if ( err < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/telldir/telldir_4.c b/testsuite/libsmbclient/src/telldir/telldir_4.c new file mode 100644 index 0000000000..da9ca00b4d --- /dev/null +++ b/testsuite/libsmbclient/src/telldir/telldir_4.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <stdlib.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 dh = 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); + + dh = smbc_opendir(url); + //printf("directory handle: %i\n",dh); + smbc_telldir(dh); + err = errno; + //printf("err: %i\n",err); + + + } + + return err; + +} diff --git a/testsuite/libsmbclient/src/telldir/telldir_5.c b/testsuite/libsmbclient/src/telldir/telldir_5.c new file mode 100644 index 0000000000..3d7e92fb06 --- /dev/null +++ b/testsuite/libsmbclient/src/telldir/telldir_5.c @@ -0,0 +1,122 @@ +#include <stdio.h> +#include <stdlib.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; + int dh = 0; + int entry_num = 0; + int i = 0; + int offset = 0; + int dirsize = 0; + char *file_name; + char *tmp_file_ptr; + + struct smbc_dirent *dirptr; + + + char buff[MAX_BUFF_SIZE]; + char url[MAX_BUFF_SIZE]; + char file_url[MAX_BUFF_SIZE]; + char dir_url[MAX_BUFF_SIZE]; + char dirbuff[MAX_BUFF_SIZE]; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(file_url,MAX_BUFF_SIZE); + bzero(dir_url,MAX_BUFF_SIZE); + bzero(buff,MAX_BUFF_SIZE); + + if ( argc == 6 ) + { + + dirptr = (struct smbc_dirent *) dirbuff; + + 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); + + strncpy(file_url,"tempfile-",9); + tmp_file_ptr = file_url; + tmp_file_ptr += 9; + + smbc_rmdir(url); + smbc_mkdir(url,0666); + + entry_num = atoi(argv[5]); + strcat(dir_url,url); + strcat(dir_url,"/"); + + file_name = dir_url; + file_name += strlen(dir_url); + + for ( i = 0; i < entry_num; i++ ) + { + sprintf(buff,"%d",i); + memcpy(tmp_file_ptr,buff,strlen(buff)+4); + strncat(tmp_file_ptr,".txt",4); + strcpy(file_name,file_url); + fd = smbc_open(dir_url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + } + + dh = smbc_opendir(url); + err = 0; + + while ( 1 ) + { + dirptr = smbc_readdir(dh); + + if ( dirptr == NULL ) + { + break; + } + + (char*)dirsize += dirptr->dirlen; + + } + + offset = smbc_telldir(dh); + + if ( offset != dirsize ) + { + //printf("offset: %i dirsize: %i\n",offset,dirsize); + err = 1; + } + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_1.c b/testsuite/libsmbclient/src/unlink/unlink_1.c new file mode 100644 index 0000000000..12e9d1d0aa --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_1.c @@ -0,0 +1,61 @@ +#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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + err = smbc_unlink(url); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_10.c b/testsuite/libsmbclient/src/unlink/unlink_10.c new file mode 100644 index 0000000000..58f541c69a --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_10.c @@ -0,0 +1,62 @@ +#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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0000); + smbc_close(fd); + + strncpy(g_username, "xxxxxx", 6); + strncpy(g_password, "xxxxxx", 6); + + smbc_unlink(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_11.c b/testsuite/libsmbclient/src/unlink/unlink_11.c new file mode 100644 index 0000000000..f94b93d048 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_11.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 fd = 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0000); + smbc_close(fd); + + strncpy(g_username, "xxxxxx", 6); + strncpy(g_password, "xxxxxx", 6); + + err = smbc_unlink(url); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_12.c b/testsuite/libsmbclient/src/unlink/unlink_12.c new file mode 100644 index 0000000000..f6082595a3 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_12.c @@ -0,0 +1,65 @@ +#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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + smbc_unlink(url); + + fd = smbc_open(url, O_RDWR, 0666); + + if ( fd < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_2.c b/testsuite/libsmbclient/src/unlink/unlink_2.c new file mode 100644 index 0000000000..3980704847 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_2.c @@ -0,0 +1,61 @@ +#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 == 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); + fd = smbc_mkdir(url, 0666); + err = smbc_unlink(url); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_3.c b/testsuite/libsmbclient/src/unlink/unlink_3.c new file mode 100644 index 0000000000..551a651ae4 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_3.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 == 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); + fd = smbc_mkdir(url, 0666); + smbc_unlink(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_4.c b/testsuite/libsmbclient/src/unlink/unlink_4.c new file mode 100644 index 0000000000..309dc39639 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_4.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 fd = 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[6],strlen(argv[6])); + + smbc_init(auth_fn, 0); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + strncpy(g_username,argv[4],strlen(argv[4])); + strncpy(g_password,argv[5],strlen(argv[5])); + + err = smbc_unlink(url); + + if ( err < 0 ) + err = 1; + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_5.c b/testsuite/libsmbclient/src/unlink/unlink_5.c new file mode 100644 index 0000000000..73a8e057a6 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_5.c @@ -0,0 +1,62 @@ +#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 == 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + err = smbc_unlink(url); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_6.c b/testsuite/libsmbclient/src/unlink/unlink_6.c new file mode 100644 index 0000000000..334c3653d1 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_6.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 fd = 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); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + smbc_unlink(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_7.c b/testsuite/libsmbclient/src/unlink/unlink_7.c new file mode 100644 index 0000000000..cda3c9d7b0 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_7.c @@ -0,0 +1,62 @@ +#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 == 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[6],strlen(argv[6])); + + smbc_init(auth_fn, 0); + fd = smbc_open(url, O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + strncpy(g_username,argv[4],strlen(argv[4])); + strncpy(g_password,argv[5],strlen(argv[5])); + + smbc_unlink(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_8.c b/testsuite/libsmbclient/src/unlink/unlink_8.c new file mode 100644 index 0000000000..2053be3c96 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_8.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 == 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); + smbc_unlink(url); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink/unlink_9.c b/testsuite/libsmbclient/src/unlink/unlink_9.c new file mode 100644 index 0000000000..78f9c29748 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink/unlink_9.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 == 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); + err = smbc_unlink(url); + + if ( err < 0 ) + err = 1; + + + } + + return 1; + +} + diff --git a/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_1.c b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_1.c new file mode 100644 index 0000000000..1b937192a0 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_1.c @@ -0,0 +1,107 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + smbc_list_print_jobs(argv[6],print_list_fn); + + g_print_id = -1; + err = smbc_unlink_print_job(argv[6],g_print_id); + + if ( err < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_2.c b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_2.c new file mode 100644 index 0000000000..49c9ef6687 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_2.c @@ -0,0 +1,102 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + smbc_list_print_jobs(argv[6],print_list_fn); + + g_print_id = -1; + smbc_unlink_print_job(argv[6],g_print_id); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_3.c b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_3.c new file mode 100644 index 0000000000..a4cbf42fec --- /dev/null +++ b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_3.c @@ -0,0 +1,106 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + smbc_list_print_jobs(argv[6],print_list_fn); + + err = smbc_unlink_print_job(argv[6],g_print_id); + + if ( err < 0 ) + + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_4.c b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_4.c new file mode 100644 index 0000000000..156d341394 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_4.c @@ -0,0 +1,101 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_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); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + smbc_print_file(url,argv[6]); + smbc_list_print_jobs(argv[6],print_list_fn); + + smbc_unlink_print_job(argv[6],g_print_id); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_5.c b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_5.c new file mode 100644 index 0000000000..4ba5e208b2 --- /dev/null +++ b/testsuite/libsmbclient/src/unlink_print_job/unlink_print_job_5.c @@ -0,0 +1,141 @@ +#include <stdio.h> +#include <stdlib.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]; + +char g_print_user[MAX_BUFF_SIZE]; +char g_print_name[MAX_BUFF_SIZE]; +unsigned int g_print_id; +unsigned int g_print_priority; +unsigned int g_print_size; + +unsigned int print_ids[MAX_BUFF_SIZE]; +unsigned int print_id_count; +int call_flag; + +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); + +} + +void print_list_fn_2(struct print_job_info *pji) +{ + + print_ids[print_id_count] = pji->id; + print_id_count++; + + //fprintf(stdout, "Call to Second Print Function - Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +void print_list_fn(struct print_job_info *pji) +{ + + g_print_id = pji->id; + g_print_priority = pji->priority; + g_print_size = pji->size; + strcpy(g_print_user,pji->user); + strcpy(g_print_name,pji->name); + + //fprintf(stdout, "Call to First Print Function - Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n", + // pji->id, pji->priority, pji->size, pji->user, pji->name); + +} + +int main(int argc, char** argv) +{ + int err = -1; + int fd = 0; + unsigned int i = 0; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + bzero(g_workgroup,MAX_BUFF_SIZE); + bzero(url,MAX_BUFF_SIZE); + bzero(g_print_user,MAX_BUFF_SIZE); + bzero(g_print_name,MAX_BUFF_SIZE); + + g_print_id = 0; + g_print_priority = 0; + g_print_size = 0; + + print_id_count = 0; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + //printf("Message: %s\n",message); + //printf("Message len: %i\n",msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + smbc_print_file(url,argv[6]); + smbc_print_file(url,argv[6]); + smbc_print_file(url,argv[6]); + + smbc_list_print_jobs(argv[6],print_list_fn); + + if ( smbc_unlink_print_job(argv[6],g_print_id) == 0 ) + { + if ( smbc_list_print_jobs(argv[6],print_list_fn_2) == 0 ) + { + err = 0; + + for ( i=0; i<print_id_count; i++ ) + { + if ( g_print_id == print_ids[i] ) + { + err = 1; + break; + } + + } + } + + } else + err = 1; + + + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_1.c b/testsuite/libsmbclient/src/write/write_1.c new file mode 100644 index 0000000000..fa147f8f50 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_1.c @@ -0,0 +1,77 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + err = smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + if ( err < 0 ) + err = 1; + + else if ( err != msg_len ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_10.c b/testsuite/libsmbclient/src/write/write_10.c new file mode 100644 index 0000000000..1f43c60bb7 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_10.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message = NULL; + + 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); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + msg_len = 10; + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + + err = errno; + + smbc_close(fd); + + free(message); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_11.c b/testsuite/libsmbclient/src/write/write_11.c new file mode 100644 index 0000000000..3f9ae3f97d --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_11.c @@ -0,0 +1,83 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDWR, 0666); + smbc_write(fd, message, msg_len); + smbc_close(fd); + + fd = smbc_open(url, O_RDONLY, 0666); + smbc_read(fd,response,msg_len); + smbc_close(fd); + + if ( memcmp ( message, response, msg_len) == 0 ) + err = 0; + + else + err = 1; + + free(message); + free(response); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_12.c b/testsuite/libsmbclient/src/write/write_12.c new file mode 100644 index 0000000000..3528dbb36e --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_12.c @@ -0,0 +1,83 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + strncpy(g_username,"xxxxxxxx",8); + strncpy(g_password,"xxxxxxxx",8); + + fd = smbc_open(url, O_RDWR, 0666); + + err = smbc_write(fd, message, msg_len); + smbc_close(fd); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + free(message); + free(response); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_13.c b/testsuite/libsmbclient/src/write/write_13.c new file mode 100644 index 0000000000..f3c2ad5bc3 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_13.c @@ -0,0 +1,87 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + char* response; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + response = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + strncpy(g_username,"xxxxxxxx",8); + strncpy(g_password,"xxxxxxxx",8); + + fd = smbc_open(url, O_RDWR, 0666); + + if (fd < 0) + + err = errno; + + else { + + smbc_write(fd, message, msg_len); + err = errno; + + smbc_close(fd); + + } + + free(message); + free(response); + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_2.c b/testsuite/libsmbclient/src/write/write_2.c new file mode 100644 index 0000000000..49763ebe0c --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_2.c @@ -0,0 +1,71 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + + smbc_write(fd, message, msg_len); + err = errno; + + smbc_close(fd); + + free(message); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_3.c b/testsuite/libsmbclient/src/write/write_3.c new file mode 100644 index 0000000000..254782946d --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_3.c @@ -0,0 +1,79 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDONLY, 0666); + err = smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + if ( err < 0 ) + err = 1; + + else if ( err != msg_len ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_4.c b/testsuite/libsmbclient/src/write/write_4.c new file mode 100644 index 0000000000..6ee585f021 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_4.c @@ -0,0 +1,74 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_RDONLY, 0666); + + smbc_write(fd, message, msg_len); + err = errno; + + smbc_close(fd); + + free(message); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_5.c b/testsuite/libsmbclient/src/write/write_5.c new file mode 100644 index 0000000000..84cb50123c --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_5.c @@ -0,0 +1,79 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_WRONLY, 0666); + err = smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + if ( err < 0 ) + err = 1; + + else if ( err != msg_len ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_6.c b/testsuite/libsmbclient/src/write/write_6.c new file mode 100644 index 0000000000..c139ff8137 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_6.c @@ -0,0 +1,74 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message; + + 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])); + + msg_len = strlen(argv[5])+1; + message = malloc(msg_len); + message[msg_len - 1] = 0; + strncpy(message,argv[5],msg_len); + + smbc_init(auth_fn, 0); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + fd = smbc_open(url, O_WRONLY, 0666); + + smbc_write(fd, message, msg_len); + err = errno; + + smbc_close(fd); + + free(message); + + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_7.c b/testsuite/libsmbclient/src/write/write_7.c new file mode 100644 index 0000000000..b0ce9b6fa2 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_7.c @@ -0,0 +1,60 @@ +#include <stdio.h> +#include <stdlib.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* message = "Testing"; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + fd = 10345; // Random value for File Descriptor + smbc_init(auth_fn, 0); + err = smbc_write(fd, message, sizeof(message)); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_8.c b/testsuite/libsmbclient/src/write/write_8.c new file mode 100644 index 0000000000..4176bec601 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_8.c @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <stdlib.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* message = "Testing"; + + bzero(g_workgroup,MAX_BUFF_SIZE); + + if ( argc == 4 ) + { + + strncpy(g_workgroup,argv[1],strlen(argv[1])); + strncpy(g_username,argv[2],strlen(argv[2])); + strncpy(g_password,argv[3],strlen(argv[3])); + + fd = 10345; // Random value for File Descriptor + smbc_init(auth_fn, 0); + err = smbc_write(fd, message, sizeof(message)); + + err = errno; + + } + + return err; + +} + diff --git a/testsuite/libsmbclient/src/write/write_9.c b/testsuite/libsmbclient/src/write/write_9.c new file mode 100644 index 0000000000..b707d5c688 --- /dev/null +++ b/testsuite/libsmbclient/src/write/write_9.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <stdlib.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; + int msg_len = 0; + char url[MAX_BUFF_SIZE]; + char* message = NULL; + + 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); + smbc_unlink(url); + fd = smbc_open(url,O_RDWR | O_CREAT, 0666); + smbc_close(fd); + + msg_len = 10; + fd = smbc_open(url, O_RDWR, 0666); + err = smbc_write(fd, message, msg_len); + smbc_close(fd); + + free(message); + + if ( err < 0 ) + err = 1; + + else + err = 0; + + } + + return err; + +} + |