Blame SOURCES/lockdev-euidaccess.patch

203a18
diff -up lockdev-scm-2011-10-07/src/lockdev.c.access lockdev-scm-2011-10-07/src/lockdev.c
203a18
--- lockdev-scm-2011-10-07/src/lockdev.c.access	2011-07-22 09:37:10.000000000 +0200
203a18
+++ lockdev-scm-2011-10-07/src/lockdev.c	2013-06-03 12:34:16.870750845 +0200
203a18
@@ -616,7 +616,10 @@ dev_lock (const char *devname)
203a18
 	if ( stat( device, &statbuf) == -1 ) {
203a18
 		close_n_return(-errno);
203a18
 	}
203a18
-	if ( access( device, W_OK ) == -1 ) {
203a18
+	/* check that the caller has write permission to the device
203a18
+	 * to prevent denial-of-service attack by unauthorized users
203a18
+	 */
203a18
+	if ( euidaccess( device, W_OK ) == -1 ) {
203a18
 		close_n_return(-errno);
203a18
 	}
203a18
 
203a18
@@ -780,7 +783,10 @@ dev_relock (const char  *devname,
203a18
 	if ( stat( device, &statbuf) == -1 ) {
203a18
 		close_n_return(-errno);
203a18
 	}
203a18
-	if ( access( device, W_OK ) == -1 ) {
203a18
+	/* check that the caller has write permission to the device
203a18
+	 * to prevent denial-of-service attack by unauthorized users
203a18
+	 */
203a18
+	if ( euidaccess( device, W_OK ) == -1 ) {
203a18
 		close_n_return(-errno);
203a18
 	}
203a18
 
203a18
@@ -870,7 +876,10 @@ dev_unlock (const char *devname,
203a18
 	if ( stat( device, &statbuf) == -1 ) {
203a18
 		close_n_return(-errno);
203a18
 	}
203a18
-	if ( access( device, W_OK ) == -1 ) {
203a18
+	/* check that the caller has write permission to the device
203a18
+	 * to prevent denial-of-service attack by unauthorized users
203a18
+	 */
203a18
+	if ( euidaccess( device, W_OK ) == -1 ) {
203a18
 		close_n_return(-errno);
203a18
 	}
203a18