[prev in list] [next in list] [prev in thread] [next in thread]
List: drbd-cvs
Subject: [DRBD-cvs] svn commit by phil - r2608 - trunk/user - Warn the user
From: drbd-cvs () linbit ! com
Date: 2006-12-01 10:58:10
Message-ID: 20061201105810.B97B42D9E181 () mail ! linbit ! com
[Download RAW message or body]
Author: phil
Date: 2006-12-01 11:58:08 +0100 (Fri, 01 Dec 2006)
New Revision: 2608
Modified:
trunk/user/drbdadm_main.c
Log:
Warn the user in case his permissions for drbdsetup/drbdmeta are
wrong for the use with dopd/drbd-peer-outdater.
Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c 2006-12-01 09:41:58 UTC (rev 2607)
+++ trunk/user/drbdadm_main.c 2006-12-01 10:58:08 UTC (rev 2608)
@@ -1353,6 +1353,37 @@
return !ep;
}
+void sanity_check_cmd(char* cmd)
+{
+ struct stat sb;
+ int err;
+
+ if ( (err=stat(cmd,&sb)) ) {
+ perror("stat() of drbdsetup/drbdmeta failed");
+ exit(10);
+ }
+
+ if(!sb.st_mode&S_ISUID || sb.st_mode&S_IXOTH || sb.st_gid==0) {
+ fprintf(stderr,"WARN:\n"
+ " You are using the 'drbd-peer-outdater' as outdate-peer program.\n"
+ " If you use that mechanism the dopd heartbeat plugin program needs\n"
+ " to be able to call drbdsetup and drbdmeta with root privileges.\n\n"
+ " You need to fix this with these commands:\n"
+ " chgrp haclient %s ; chmod o-x %s ; chmod u+s %s\n\n\n",
+ cmd,cmd,cmd);
+ }
+}
+
+void sanity_check_perm()
+{
+ static int checked=0;
+
+ if(checked) return;
+
+ sanity_check_cmd(drbdsetup);
+ sanity_check_cmd(drbdmeta);
+}
+
void validate_resource(struct d_resource * res)
{
struct d_option* opt;
@@ -1408,6 +1439,10 @@
if (res->me && res->peer) {
verify_ips(res);
}
+
+ if ( (opt = find_opt(res->handlers, "outdate-peer")) ) {
+ if(strstr(opt->value,"drbd-peer-outdater")) sanity_check_perm();
+ }
}
static void global_validate(void)
_______________________________________________
drbd-cvs mailing list
drbd-cvs@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/drbd-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic