summaryrefslogtreecommitdiff
path: root/source3/smbwrapper
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r--source3/smbwrapper/smbw.c3
-rw-r--r--source3/smbwrapper/smbw_dir.c36
-rw-r--r--source3/smbwrapper/smbw_stat.c46
3 files changed, 76 insertions, 9 deletions
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c
index 74a40a2451..3a2cbcf5ac 100644
--- a/source3/smbwrapper/smbw.c
+++ b/source3/smbwrapper/smbw.c
@@ -390,8 +390,7 @@ struct smbw_server *smbw_server(char *server, char *share)
return NULL;
}
- if (!cli_send_tconX(&c, share,
- strstr(share,"IPC$")?"IPC":"A:",
+ if (!cli_send_tconX(&c, share, "?????",
password, strlen(password)+1)) {
errno = smbw_errno(&c);
cli_shutdown(&c);
diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c
index a127048793..3fdaebec5a 100644
--- a/source3/smbwrapper/smbw_dir.c
+++ b/source3/smbwrapper/smbw_dir.c
@@ -113,6 +113,28 @@ static void smbw_share_add(const char *share, uint32 type, const char *comment)
/*****************************************************
+add a entry to a directory listing
+*******************************************************/
+static void smbw_printjob_add(struct print_job_info *job)
+{
+ struct file_info finfo;
+
+ ZERO_STRUCT(finfo);
+
+ pstrcpy(finfo.name, job->name);
+ finfo.mode = aRONLY | aDIR;
+ finfo.mtime = job->t;
+ finfo.atime = job->t;
+ finfo.ctime = job->t;
+ finfo.uid = nametouid(job->user);
+ finfo.mode = aRONLY;
+ finfo.size = job->size;
+
+ smbw_dir_add(&finfo);
+}
+
+
+/*****************************************************
open a directory on the server
*******************************************************/
int smbw_dir_open(const char *fname)
@@ -159,15 +181,20 @@ int smbw_dir_open(const char *fname)
slprintf(mask, sizeof(mask)-1, "%s\\*", path);
string_sub(mask,"\\\\","\\");
- if (strcmp(share,"IPC$") == 0) {
+ if (strcmp(srv->cli.dev,"IPC") == 0) {
DEBUG(4,("doing NetShareEnum\n"));
- if (cli_RNetShareEnum(&srv->cli, smbw_share_add) <= 0) {
+ if (cli_RNetShareEnum(&srv->cli, smbw_share_add) < 0) {
+ errno = smbw_errno(&srv->cli);
+ goto failed;
+ }
+ } else if (strncmp(srv->cli.dev,"LPT",3) == 0) {
+ if (cli_print_queue(&srv->cli, smbw_printjob_add) < 0) {
errno = smbw_errno(&srv->cli);
goto failed;
}
} else {
if (cli_list(&srv->cli, mask, aHIDDEN|aSYSTEM|aDIR,
- smbw_dir_add) <= 0) {
+ smbw_dir_add) < 0) {
errno = smbw_errno(&srv->cli);
goto failed;
}
@@ -344,7 +371,8 @@ int smbw_chdir(const char *name)
goto failed;
}
- if (strcmp(share,"IPC$") &&
+ if (strncmp(srv->cli.dev,"IPC",3) &&
+ strncmp(srv->cli.dev,"LPT",3) &&
!smbw_getatr(srv, path,
&mode, NULL, NULL, NULL, NULL)) {
errno = smbw_errno(&srv->cli);
diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c
index ae8671c591..69ca38a2ae 100644
--- a/source3/smbwrapper/smbw_stat.c
+++ b/source3/smbwrapper/smbw_stat.c
@@ -74,6 +74,38 @@ BOOL smbw_getatr(struct smbw_server *srv, char *path,
return False;
}
+
+static struct print_job_info printjob;
+
+/*****************************************************
+gather info from a printjob listing
+*******************************************************/
+static void smbw_printjob_stat(struct print_job_info *job)
+{
+ if (strcmp(job->name, printjob.name) == 0) {
+ printjob = *job;
+ }
+}
+
+/*****************************************************
+stat a printjob
+*******************************************************/
+int smbw_stat_printjob(struct smbw_server *srv,char *path,
+ size_t *size, time_t *m_time)
+{
+ if (path[0] == '\\') path++;
+
+ ZERO_STRUCT(printjob);
+
+ fstrcpy(printjob.name, path);
+ cli_print_queue(&srv->cli, smbw_printjob_stat);
+
+ *size = printjob.size;
+ *m_time = printjob.t;
+ return 0;
+}
+
+
/*****************************************************
a wrapper for fstat()
*******************************************************/
@@ -151,8 +183,16 @@ int smbw_stat(const char *fname, struct stat *st)
goto failed;
}
- if (strcmp(share,"IPC$") == 0) {
+ if (strncmp(srv->cli.dev,"IPC",3) == 0) {
mode = aDIR | aRONLY;
+ } else if (strncmp(srv->cli.dev,"LPT",3) == 0) {
+ if (strcmp(path,"\\") == 0) {
+ mode = aDIR | aRONLY;
+ } else {
+ mode = aRONLY;
+ smbw_stat_printjob(srv, path, &size, &m_time);
+ c_time = a_time = m_time;
+ }
} else {
if (!smbw_getatr(srv, path,
&mode, &size, &c_time, &a_time, &m_time)) {
@@ -163,8 +203,8 @@ int smbw_stat(const char *fname, struct stat *st)
smbw_setup_stat(st, path, size, mode);
- st->st_atime = time(NULL);
- st->st_ctime = m_time;
+ st->st_atime = a_time;
+ st->st_ctime = c_time;
st->st_mtime = m_time;
st->st_dev = srv->dev;