summaryrefslogtreecommitdiff
path: root/source3/client/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/client/client.c')
-rw-r--r--source3/client/client.c95
1 files changed, 74 insertions, 21 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 59e5c1ad72..2edeb1ae2b 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2725,7 +2725,7 @@ static int cmd_link(void)
return 1;
}
- if (!cli_unix_hardlink(targetcli, targetname, newname)) {
+ if (!NT_STATUS_IS_OK(cli_posix_hardlink(targetcli, targetname, newname))) {
d_printf("%s linking files (%s -> %s)\n", cli_errstr(targetcli), newname, oldname);
return 1;
}
@@ -2733,6 +2733,54 @@ static int cmd_link(void)
}
/****************************************************************************
+ UNIX readlink.
+****************************************************************************/
+
+static int cmd_readlink(void)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ char *name= NULL;
+ char *buf = NULL;
+ char *targetname = NULL;
+ char linkname[PATH_MAX+1];
+ struct cli_state *targetcli;
+
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+ d_printf("readlink <name>\n");
+ return 1;
+ }
+ name = talloc_asprintf(ctx,
+ "%s%s",
+ client_get_cur_dir(),
+ buf);
+ if (!name) {
+ return 1;
+ }
+
+ if (!cli_resolve_path(ctx, "", auth_info, cli, name, &targetcli, &targetname)) {
+ d_printf("readlink %s: %s\n", name, cli_errstr(cli));
+ return 1;
+ }
+
+ if (!SERVER_HAS_UNIX_CIFS(targetcli)) {
+ d_printf("Server doesn't support UNIX CIFS calls.\n");
+ return 1;
+ }
+
+ if (!NT_STATUS_IS_OK(cli_posix_readlink(targetcli, name,
+ linkname, PATH_MAX+1))) {
+ d_printf("%s readlink on file %s\n",
+ cli_errstr(targetcli), name);
+ return 1;
+ }
+
+ d_printf("%s -> %s\n", name, linkname);
+
+ return 0;
+}
+
+
+/****************************************************************************
UNIX symlink.
****************************************************************************/
@@ -2776,7 +2824,7 @@ static int cmd_symlink(void)
return 1;
}
- if (!cli_unix_symlink(targetcli, targetname, newname)) {
+ if (!NT_STATUS_IS_OK(cli_posix_symlink(targetcli, targetname, newname))) {
d_printf("%s symlinking files (%s -> %s)\n",
cli_errstr(targetcli), newname, targetname);
return 1;
@@ -3022,7 +3070,7 @@ static int cmd_getfacl(void)
}
d_printf("# file: %s\n", src);
- d_printf("# owner: %u\n# group: %u\n", (unsigned int)sbuf.st_uid, (unsigned int)sbuf.st_gid);
+ d_printf("# owner: %u\n# group: %u\n", (unsigned int)sbuf.st_ex_uid, (unsigned int)sbuf.st_ex_gid);
if (num_file_acls == 0 && num_dir_acls == 0) {
d_printf("No acls found.\n");
@@ -3120,6 +3168,7 @@ static int cmd_stat(void)
fstring mode_str;
SMB_STRUCT_STAT sbuf;
struct tm *lt;
+ time_t tmp_time;
if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
d_printf("stat file\n");
@@ -3152,30 +3201,31 @@ static int cmd_stat(void)
/* Print out the stat values. */
d_printf("File: %s\n", src);
d_printf("Size: %-12.0f\tBlocks: %u\t%s\n",
- (double)sbuf.st_size,
- (unsigned int)sbuf.st_blocks,
- filetype_to_str(sbuf.st_mode));
+ (double)sbuf.st_ex_size,
+ (unsigned int)sbuf.st_ex_blocks,
+ filetype_to_str(sbuf.st_ex_mode));
#if defined(S_ISCHR) && defined(S_ISBLK)
- if (S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode)) {
+ if (S_ISCHR(sbuf.st_ex_mode) || S_ISBLK(sbuf.st_ex_mode)) {
d_printf("Inode: %.0f\tLinks: %u\tDevice type: %u,%u\n",
- (double)sbuf.st_ino,
- (unsigned int)sbuf.st_nlink,
- unix_dev_major(sbuf.st_rdev),
- unix_dev_minor(sbuf.st_rdev));
+ (double)sbuf.st_ex_ino,
+ (unsigned int)sbuf.st_ex_nlink,
+ unix_dev_major(sbuf.st_ex_rdev),
+ unix_dev_minor(sbuf.st_ex_rdev));
} else
#endif
d_printf("Inode: %.0f\tLinks: %u\n",
- (double)sbuf.st_ino,
- (unsigned int)sbuf.st_nlink);
+ (double)sbuf.st_ex_ino,
+ (unsigned int)sbuf.st_ex_nlink);
d_printf("Access: (0%03o/%s)\tUid: %u\tGid: %u\n",
- ((int)sbuf.st_mode & 0777),
- unix_mode_to_str(mode_str, sbuf.st_mode),
- (unsigned int)sbuf.st_uid,
- (unsigned int)sbuf.st_gid);
+ ((int)sbuf.st_ex_mode & 0777),
+ unix_mode_to_str(mode_str, sbuf.st_ex_mode),
+ (unsigned int)sbuf.st_ex_uid,
+ (unsigned int)sbuf.st_ex_gid);
- lt = localtime(&sbuf.st_atime);
+ tmp_time = convert_timespec_to_time_t(sbuf.st_ex_atime);
+ lt = localtime(&tmp_time);
if (lt) {
strftime(mode_str, sizeof(mode_str), "%Y-%m-%d %T %z", lt);
} else {
@@ -3183,7 +3233,8 @@ static int cmd_stat(void)
}
d_printf("Access: %s\n", mode_str);
- lt = localtime(&sbuf.st_mtime);
+ tmp_time = convert_timespec_to_time_t(sbuf.st_ex_mtime);
+ lt = localtime(&tmp_time);
if (lt) {
strftime(mode_str, sizeof(mode_str), "%Y-%m-%d %T %z", lt);
} else {
@@ -3191,7 +3242,8 @@ static int cmd_stat(void)
}
d_printf("Modify: %s\n", mode_str);
- lt = localtime(&sbuf.st_ctime);
+ tmp_time = convert_timespec_to_time_t(sbuf.st_ex_ctime);
+ lt = localtime(&tmp_time);
if (lt) {
strftime(mode_str, sizeof(mode_str), "%Y-%m-%d %T %z", lt);
} else {
@@ -3400,7 +3452,7 @@ static int cmd_newer(void)
ok = next_token_talloc(ctx, &cmd_ptr,&buf,NULL);
if (ok && (sys_stat(buf,&sbuf) == 0)) {
- newer_than = sbuf.st_mtime;
+ newer_than = convert_timespec_to_time_t(sbuf.st_ex_mtime);
DEBUG(1,("Getting files newer than %s",
time_to_asc(newer_than)));
} else {
@@ -3949,6 +4001,7 @@ static struct {
{"q",cmd_quit,"logoff the server",{COMPL_NONE,COMPL_NONE}},
{"queue",cmd_queue,"show the print queue",{COMPL_NONE,COMPL_NONE}},
{"quit",cmd_quit,"logoff the server",{COMPL_NONE,COMPL_NONE}},
+ {"readlink",cmd_readlink,"filename Do a UNIX extensions readlink call on a symlink",{COMPL_REMOTE,COMPL_REMOTE}},
{"rd",cmd_rmdir,"<directory> remove a directory",{COMPL_NONE,COMPL_NONE}},
{"recurse",cmd_recurse,"toggle directory recursion for mget and mput",{COMPL_NONE,COMPL_NONE}},
{"reget",cmd_reget,"<remote name> [local name] get a file restarting at end of local file",{COMPL_REMOTE,COMPL_LOCAL}},