All of lore.kernel.org
 help / color / mirror / Atom feed
From: prajnoha@sourceware.org <prajnoha@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/misc/lvm-file.c
Date: 8 Jun 2011 08:49:54 -0000	[thread overview]
Message-ID: <20110608084954.2300.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha at sourceware.org	2011-06-08 08:49:54

Modified files:
	.              : WHATS_NEW 
	lib/misc       : lvm-file.c 

Log message:
	Fix create_temp_name to replace any '/' found in the hostname with '?'.
	
	There's a possibility someone will use the '/' in the hostname. Since we
	generate a temporary file name (path) including the hostname, any '/' would
	be ambiguous.
	
	We can always set such hostname using 'sethostname' from unistd.h. But the
	'hostname' command already includes the check and removes the '/' char.
	However, some old versions still allow that.
	See: https://bugzilla.redhat.com/show_bug.cgi?id=711445.
	
	Since this is only a temporary name and the possibility of this error is
	quite negligible, we don't need any complex escape sequence here, just a
	simple char replace.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2006&r2=1.2007
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28

--- LVM2/WHATS_NEW	2011/06/02 09:02:03	1.2006
+++ LVM2/WHATS_NEW	2011/06/08 08:49:53	1.2007
@@ -1,5 +1,6 @@
 Version 2.02.86 -  
 =================================
+  Fix create_temp_name to replace any '/' found in the hostname with '?'.
   Always use append to file in lvmdump (selinux policy - no file truncation).
   Propagate test mode to clvmd to skip activation and changes to held locks.
   Defer writing PV labels to vg_write.
--- LVM2/lib/misc/lvm-file.c	2009/07/15 20:02:47	1.27
+++ LVM2/lib/misc/lvm-file.c	2011/06/08 08:49:54	1.28
@@ -35,6 +35,7 @@
 	int i, num;
 	pid_t pid;
 	char hostname[255];
+	char *p;
 	struct flock lock = {
 		.l_type = F_WRLCK,
 		.l_whence = 0,
@@ -48,6 +49,12 @@
 		log_sys_error("gethostname", "");
 		strcpy(hostname, "nohostname");
 	}
+	else {
+		/* Replace any '/' with '?' found in the hostname. */
+		p = hostname;
+		while ((p = strchr(p, '/')))
+			*p = '?';
+	}
 
 	for (i = 0; i < 20; i++, num++) {
 



             reply	other threads:[~2011-06-08  8:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  8:49 prajnoha [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-28 15:20 LVM2 ./WHATS_NEW lib/misc/lvm-file.c meyering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110608084954.2300.qmail@sourceware.org \
    --to=prajnoha@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.