@@ -5,7 +5,7 @@
#
include ../Makefile.inc
-LIBDMMP_VERSION=0.1.0
+LIBDMMP_VERSION=0.2.0
SONAME=$(LIBDMMP_VERSION)
DEVLIB = libdmmp.so
LIBS = $(DEVLIB).$(SONAME)
@@ -364,6 +364,14 @@ invoke:
}
}
+ if ((*output != NULL) &&
+ strncmp(*output, "permission deny",
+ strlen("permission deny")) == 0) {
+ _error(ctx, "Permission deny, need to be root");
+ rc = DMMP_ERR_PERMISSION_DENY;
+ goto out;
+ }
+
out:
if (rc != DMMP_OK) {
free(*output);
@@ -42,6 +42,7 @@ extern "C" {
#define DMMP_ERR_MPATH_BUSY 7
#define DMMP_ERR_MPATH_NOT_FOUND 8
#define DMMP_ERR_INVALID_ARGUMENT 9
+#define DMMP_ERR_PERMISSION_DENY 10
/*
* Use the syslog severity level as log priority
@@ -679,6 +680,8 @@ DMMP_DLL_EXPORT const char *dmmp_path_status_str(uint32_t path_status);
*
* * DMMP_ERR_INVALID_ARGUMENT
*
+ * * DMMP_ERR_PERMISSION_DENY
+ *
* Error number could be converted to string by dmmp_strerror().
*/
DMMP_DLL_EXPORT int dmmp_flush_mpath(struct dmmp_context *ctx,
@@ -704,6 +707,8 @@ DMMP_DLL_EXPORT int dmmp_flush_mpath(struct dmmp_context *ctx,
*
* * DMMP_ERR_NO_DAEMON
*
+ * * DMMP_ERR_PERMISSION_DENY
+ *
* Error number could be converted to string by dmmp_strerror().
*/
DMMP_DLL_EXPORT int dmmp_reconfig(struct dmmp_context *ctx);
@@ -49,6 +49,7 @@ static const struct _num_str_conv _DMMP_RC_MSG_CONV[] = {
{DMMP_ERR_MPATH_BUSY, "Specified multipath device map is in use"},
{DMMP_ERR_MPATH_NOT_FOUND, "Specified multipath not found"},
{DMMP_ERR_INVALID_ARGUMENT, "Invalid argument"},
+ {DMMP_ERR_PERMISSION_DENY, "Permission deny"},
};
_dmmp_str_func_gen(dmmp_strerror, int, rc, _DMMP_RC_MSG_CONV);
* Indicate user does not have privilege to flush mpath or invoke reconfig. * Bump API version to 0.2.0 for this API addition. Signed-off-by: Gris Ge <fge@redhat.com> --- libdmmp/Makefile | 2 +- libdmmp/libdmmp.c | 8 ++++++++ libdmmp/libdmmp/libdmmp.h | 5 +++++ libdmmp/libdmmp_misc.c | 1 + 4 files changed, 15 insertions(+), 1 deletion(-)