Allow FSRVP access generic HRESULT error message descriptions
authorNoel Power <noel.power@suse.com>
Mon, 24 Mar 2014 11:52:48 +0000 (11:52 +0000)
committerStefan Metzmacher <metze@samba.org>
Wed, 2 Apr 2014 18:25:07 +0000 (20:25 +0200)
FSRVP can possibly return any HRESULT error in addition to it's own
specific errors. This change searches the HRESULT errors for a description
if the error doesn't match any of the known FSRVP ones.
Also removed some errors defined in fsrvp.idl (now that they are defined
in hresult.h)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
librpc/idl/fsrvp.idl
source3/rpcclient/cmd_fss.c
source4/torture/rpc/fsrvp.c

index 3a11b87fdc99d51f49a9ae706cf2ed315a2ecdb0..2adff15f32f963d563a3121f1a744d1af395ff32 100644 (file)
@@ -22,12 +22,6 @@ import "misc.idl";
        const uint32 FSRVP_E_OBJECT_NOT_FOUND = 0x80042308;
        const uint32 FSRVP_E_UNSUPPORTED_CONTEXT = 0x8004231B;
        const uint32 FSRVP_E_BAD_ID = 0x80042302;       /* wire, not documented */
-
-       /* TODO move these to generic herror defines or COM in orpc.idl */
-       const uint32 E_ACCESSDENIED = 0x80070005;
-       const uint32 E_INVALIDARG = 0x80070057;
-       const uint32 E_OUTOFMEMORY = 0x80000002;
-
        typedef struct {
                GUID ShadowCopySetId;
                GUID ShadowCopyId;
index 945f4d994e046093a2f2de066d8caee3de045bec..54fade7ee116c26cc9b1aaa1e427a0650c709de4 100644 (file)
@@ -23,6 +23,7 @@
 #include "rpcclient.h"
 #include "../librpc/gen_ndr/ndr_fsrvp.h"
 #include "../librpc/gen_ndr/ndr_fsrvp_c.h"
+#include "../libcli/util/hresult.h"
 
 static const struct {
        uint32_t error_code;
@@ -100,6 +101,13 @@ static const char *get_error_str(uint32_t code)
                        break;
                }
        }
+       /* error isn't specific fsrvp one, check hresult errors */
+       if (result == default_err) {
+               const char *hres_err = hresult_errstr_const(HRES_ERROR(code));
+               if (hres_err) {
+                       result = hres_err;
+               }
+       }
        return result;
 };
 
index 3a98837db25d176ebb23bfc5a78dd0bd28cd9f46..4a55d28963109504274ea6c15d2f384f2037ec7d 100644 (file)
@@ -36,6 +36,7 @@
 #include "libcli/smb2/smb2_calls.h"
 #include "libcli/smb_composite/smb_composite.h"
 #include "libcli/resolve/resolve.h"
+#include "libcli/util/hresult.h"
 #include "torture/torture.h"
 #include "torture/smb2/proto.h"
 #include "torture/rpc/torture_rpc.h"
@@ -384,7 +385,7 @@ static bool test_fsrvp_sc_set_abort(struct torture_context *tctx,
                                   "following abort");
        /*
         * XXX Windows 8 server beta returns FSRVP_E_BAD_STATE here rather than
-        * FSRVP_E_BAD_ID / E_INVALIDARG.
+        * FSRVP_E_BAD_ID / HRES_E_INVALIDARG.
         */
        torture_assert(tctx, (r_scset_add.out.result != 0),
                       "incorrect AddToShadowCopySet response following abort");
@@ -425,7 +426,7 @@ static bool test_fsrvp_bad_id(struct torture_context *tctx,
        torture_assert_ntstatus_ok(tctx, status,
                                   "DeleteShareMapping failed");
        torture_assert_int_equal(tctx, r_sharemap_del.out.result,
-                                E_INVALIDARG,
+                                HRES_ERROR_V(HRES_E_INVALIDARG),
                                 "incorrect DeleteShareMapping response");
 
        torture_assert(tctx, test_fsrvp_sc_delete(tctx, p, sc_map), "sc del");