1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Bulk add of the test suite for libsmbclient ...

This commit is contained in:
Richard Sharpe 0001-01-01 00:00:00 +00:00
parent 26d7d8af29
commit adef47b517
146 changed files with 11354 additions and 0 deletions

View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More