From owner-freebsd-bugs Wed Jan 10 10:48:10 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from djsf.sema.ru (unknown [195.128.67.240]) by hub.freebsd.org (Postfix) with ESMTP id AA27537B400 for ; Wed, 10 Jan 2001 10:47:50 -0800 (PST) Received: (from djsf@localhost) by djsf.sema.ru (8.11.0/8.11.0) id f0AInWp08756 for freebsd-bugs@FreeBSD.ORG; Wed, 10 Jan 2001 21:49:32 +0300 (MSK) (envelope-from djsf@dataforce.net) X-Authentication-Warning: djsf.sema.ru: djsf set sender to djsf@dataforce.net using -f Received: from localhost (localhost [127.0.0.1]) by djsf.sema.ru (8.11.0/8.11.0) with ESMTP id f0AImio08747 for ; Wed, 10 Jan 2001 21:48:44 +0300 (MSK) (envelope-from djsf@sema.ru) Delivered-To: p_sema-djsf@sema.ru Received: from mail.sema.ru [194.135.31.146] by localhost with POP3 (fetchmail-5.4.4) for djsf@localhost (single-drop); Wed, 10 Jan 2001 21:48:44 +0300 (MSK) Received: (qmail 24742 invoked from network); 10 Jan 2001 19:33:40 -0000 Received: from cannabis.dataforce.net (root@195.42.160.18) by 194.135.31.146 with SMTP; 10 Jan 2001 19:33:40 -0000 Received: from reactor.technarchy.ru (zxcv@peer061.pool.dataforce.net [195.42.160.188]) by cannabis.dataforce.net (8.9.0/8.8.8) with ESMTP id VAA18268 for ; Wed, 10 Jan 2001 21:46:48 +0300 Received: (from root@localhost) by reactor.technarchy.ru (8.7.1/8.7.1) id VAA25054 for djsf@dataforce.net; Mon, 10 Jan 2000 21:50:56 +0300 Date: Wed, 10 Jan 2001 21:42:41 +0300 From: andrew deryabin To: freebsd-bugs@FreeBSD.ORG Subject: patch for /usr/src/sbin/mount_cd9660/mount_cd9660.c Message-ID: <20010110214241.A2276@technarchy.nodns> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline User-Agent: Mutt/1.2.4i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-Editor: Vim-507 http://www.vim.org Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This helps to mount CDs with extra non-ISOFS (e.g., junk-filled) sessions. get_ssector() function skips tracks without correct ISOFS signature. Similar changes in iso_get_ssector() function in /sys/isofs/cd9660/cd9660_vfsops.c would help to mount such CDs as root (but does anybody use w1nd0ze software for burning bootable FreeBSD disks? :) -- cu,djsf --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mount_cd9660.c.diff" --- mount_cd9660.c.ORiG Sat Oct 9 15:54:08 1999 +++ mount_cd9660.c Wed Jan 10 21:19:04 2001 @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -194,7 +195,11 @@ struct ioc_toc_header h; struct ioc_read_toc_entry t; struct cd_toc_entry toc_buffer[100]; - int fd, ntocentries, i; + int fd, ntocentries, i, ssector, blkn; + union { + char iso_blk[ISO_DEFAULT_BLOCK_SIZE]; + struct iso_volume_descriptor vd; + } blk; if ((fd = open(dev, O_RDONLY)) == -1) return -1; @@ -218,14 +223,25 @@ close(fd); return -1; } - close(fd); for (i = ntocentries - 1; i >= 0; i--) - if ((toc_buffer[i].control & 4) != 0) - /* found a data track */ - break; - if (i < 0) - return -1; + if ((toc_buffer[i].control & 4) != 0) { + /* found a data track, checking for ISOFS signature */ + /* (stolen from /sys/isofs/cd9660/cd9660_vfsops.c) */ + ssector = ntohl(toc_buffer[i].addr.lba); + + if (lseek(fd, ISO_DEFAULT_BLOCK_SIZE * (16 + ssector), SEEK_SET) != -1) + for (blkn = 100-16; blkn; blkn--) { + if (read(fd, &blk, sizeof(blk)) == -1) + break; + if (!(bcmp(blk.vd.id, ISO_STANDARD_ID, sizeof(blk.vd.id)) && + bcmp(blk.vd.id, ISO_SIERRA_ID, sizeof(blk.vd.id)))) { + close(fd); + return ssector; + } + } + } - return ntohl(toc_buffer[i].addr.lba); + close(fd); + return -1; } --+QahgC5+KEYLbs62-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message