s4-pvfs: the STREAM_INFORMATION calls don't need any access flags
[ira/wip.git] / source4 / ntvfs / posix / pvfs_qfileinfo.c
index 8d23d707a430d11398ec5440fa7ab672c43513f5..713925d094e722fa5b506731d424b927461b85d1 100644 (file)
@@ -41,6 +41,15 @@ static uint32_t pvfs_fileinfo_access(union smb_fileinfo *info)
                needed = 0;
                break;
 
+       case RAW_FILEINFO_ACCESS_INFORMATION:
+               needed = 0;
+               break;
+
+       case RAW_FILEINFO_STREAM_INFO:
+       case RAW_FILEINFO_STREAM_INFORMATION:
+               needed = 0;
+               break;
+
        case RAW_FILEINFO_SEC_DESC:
                needed = 0;
                if (info->query_secdesc.in.secinfo_flags & (SECINFO_OWNER|SECINFO_GROUP)) {
@@ -178,6 +187,15 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
        case RAW_FILEINFO_ALL_EAS:
                return pvfs_query_all_eas(pvfs, req, name, fd, &info->all_eas.out);
 
+       case RAW_FILEINFO_SMB2_ALL_EAS: {
+               NTSTATUS status = pvfs_query_all_eas(pvfs, req, name, fd, &info->all_eas.out);
+               if (NT_STATUS_IS_OK(status) &&
+                   info->all_eas.out.num_eas == 0) {
+                       return NT_STATUS_NO_EAS_ON_FILE;
+               }
+               return status;
+       }
+
        case RAW_FILEINFO_IS_NAME_VALID:
                return NT_STATUS_OK;
 
@@ -207,6 +225,10 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
 
        case RAW_FILEINFO_NAME_INFO:
        case RAW_FILEINFO_NAME_INFORMATION:
+               if (req->ctx->protocol == PROTOCOL_SMB2) {
+                       /* strange that SMB2 doesn't have this */
+                       return NT_STATUS_NOT_SUPPORTED;
+               }
                info->name_info.out.fname.s = name->original_name;
                return NT_STATUS_OK;
 
@@ -301,7 +323,14 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
                info->all_info2.out.access_mask    = 0; /* only set by qfileinfo */
                info->all_info2.out.position       = 0; /* only set by qfileinfo */
                info->all_info2.out.mode           = 0; /* only set by qfileinfo */
-               info->all_info2.out.fname.s        = name->original_name;
+               /* windows wants the full path on disk for this
+                  result, but I really don't want to expose that on
+                  the wire, so I'll give the path with a share
+                  prefix, which is a good approximation */
+               info->all_info2.out.fname.s = talloc_asprintf(req, "\\%s\\%s",
+                                                             pvfs->share_name, 
+                                                             name->original_name);
+               NT_STATUS_HAVE_NO_MEMORY(info->all_info2.out.fname.s);
                return NT_STATUS_OK;
        }
 
@@ -314,7 +343,8 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
 NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
                        struct ntvfs_request *req, union smb_fileinfo *info)
 {
-       struct pvfs_state *pvfs = ntvfs->private_data;
+       struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+                                 struct pvfs_state);
        struct pvfs_filename *name;
        NTSTATUS status;
 
@@ -350,7 +380,8 @@ NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
 NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
                        struct ntvfs_request *req, union smb_fileinfo *info)
 {
-       struct pvfs_state *pvfs = ntvfs->private_data;
+       struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+                                 struct pvfs_state);
        struct pvfs_file *f;
        struct pvfs_file_handle *h;
        NTSTATUS status;
@@ -368,7 +399,7 @@ NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
        }
 
        /* update the file information */
-       status = pvfs_resolve_name_fd(pvfs, h->fd, h->name);
+       status = pvfs_resolve_name_handle(pvfs, h);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -380,7 +411,7 @@ NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
        switch (info->generic.level) {
        case RAW_FILEINFO_STANDARD_INFO:
        case RAW_FILEINFO_STANDARD_INFORMATION:
-               if (pvfs_delete_on_close_set(pvfs, h, NULL, NULL)) {
+               if (pvfs_delete_on_close_set(pvfs, h)) {
                        info->standard_info.out.delete_pending = 1;
                        info->standard_info.out.nlink--;
                }
@@ -388,7 +419,7 @@ NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
 
        case RAW_FILEINFO_ALL_INFO:
        case RAW_FILEINFO_ALL_INFORMATION:
-               if (pvfs_delete_on_close_set(pvfs, h, NULL, NULL)) {
+               if (pvfs_delete_on_close_set(pvfs, h)) {
                        info->all_info.out.delete_pending = 1;
                        info->all_info.out.nlink--;
                }
@@ -407,7 +438,7 @@ NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
                break;
 
        case RAW_FILEINFO_SMB2_ALL_INFORMATION:
-               if (pvfs_delete_on_close_set(pvfs, h, NULL, NULL)) {
+               if (pvfs_delete_on_close_set(pvfs, h)) {
                        info->all_info2.out.delete_pending = 1;
                        info->all_info2.out.nlink--;
                }