Unicode USB strings conversion
In the USB code (and I bet it is the same in the USB4BSD code) unicode characters in strings are converted in a very crude way to ASCII. As I have a user on the line who sees rubbish in his logs and when using usbctl/usbdevs/etc., I bet this is the problem. I'd like to try and fix this problem by using libkern/libiconv. 1) Is this the right approach to convert UTF8 to printable string in the kernel? 2) Is this needed at all in the short term future? I remember seeing attempts at making the kernel use UTF8. 3) Does anyone know of a good example in the code without me having to hunt through the kernel to find it? For reference: The code that needs replacing is: usbd_get_string(): s = buf; n = size / 2 - 1; for (i = 0; i < n && i < len - 1; i++) { c = UGETW(us.bString[i]); /* Convert from Unicode, handle buggy strings. */ if ((c & 0xff00) == 0) *s++ = c; else if ((c & 0x00ff) == 0 && swap) *s++ = c >> 8; else *s++ = '?'; } *s++ = 0; I haven't got the USB specs handy, but I believe that this is a simple way of converting LE and BE UTF8 to ASCII. Nick ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: How can I add new binaries to the mfsroot image?
>You wouldn't have to do so - you could just run a shell script from sysinstall and do what you want. That brings me back to my original problem. Yes, I can run a shell script from sysinstall, but gmirror isn't available in mfsroot, and adding gmirror to mfsroot isn't straightforward because it needs shared libraries. I think the best approach to use may very well to have a custom boot that mounts root from an NFS disk. Then I can run whatever commands I need without having to actually add anything to mfsroot... ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: [Testers wanted] /dev/console cleanups
On Tue, Nov 18, 2008 at 10:34:10PM +0100, Ed Schouten wrote: > ... > One solution would be to let xconsole just display /var/log/messages. Errr... it may be rather a pathological case, but you might want to check the content of /etc/syslog.conf on the local machine before getting too carried away with that approach. For example, on my "firewall" box at home (where I really do not want to log anything to local disk files, though I do have a serial console on it): janus(6.4-P)[1] grep -v '^#' /etc/syslog.conf *.* @bunrab.catwhisker.org janus(6.4-P)[2] And then consider the fate of bunrab -- with stuff getting logged to /var/log/messages from various machines > ... > I'll discuss this with others to decide if we should take such an > approach. I'm not trying to be obstructionist, here. If the above case is really "too pathological to consider" -- or if it's a case of me bringing that fate upon myself, I suppose -- that's actually something I can live with. It would be nice to be forwarned about it, though. :-} Peace, david -- David H. Wolfskill [EMAIL PROTECTED] Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. pgpLDVAJGmZrP.pgp Description: PGP signature
Re: How can I add new binaries to the mfsroot image?
On Wednesday 19 November 2008 02:25:12 Peter Steele wrote: > >I believe you modify /usr/src/release/${ARCH}/boot_crunch.conf to do > > this. > > >I haven't actually tried though... > > > >I think it would be possible to have a 'GEOM' menu that you can run > > prior to fdisk, label, etc that would allow you to > > >do some basic stuff like this. > > > >While the sysinstall code is a bit fugly it's not that difficult to > > hack on (speaking from limited experience :) > > Hmmm. I hadn't planned on actually creating a custom sysinstall but I > guess that's another way we could approach this. I have some research to > do... You wouldn't have to do so - you could just run a shell script from sysinstall and do what you want. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C signature.asc Description: This is a digitally signed message part.
What are proper install.cfg for configuring multiple slices?
I want to do an automated sysinstall through an install.cfg script and the script partition the install disk into three slices. I've been going through various tests trying to figure out what the proper directives are but I haven't had much luck, and I can't find any good examples. Here is a snippet of my config file: disk=ad0 bootManager=standard partition=12582912 diskPartitionEditor partition=2097152 diskPartitionEditor partition=free diskPartitionEditor ad0s1-1=ufs 4194304 / ad0s1-2=ufs 4194304 /tmp ad0s1-3=ufs 4194304 /var ad0s2-1=swap 2097152 none ad0s3-1=ufs 4194304 none ad0s3-2=ufs 4194304 none ad0s3-3=ufs 0 none diskLabelEditor diskLabelCommit My intent here is to create three slices-one 6GB in size, another 1GB in size, and the third sized to consume the remaining free space. When I run this through sysinstall, it complains that it can't find the space for the partitions. It even complains that it can't find any free space. Because the slices don't get created, the subsequent label assignments fail as well. What is the proper commands for creating multiple slices in install.cfg? Another thing I'm having trouble with is partitioning more than one disk. I have four disks that I'd like to partition as part of the install.cfg script. In fact, I want to partition the four disks more or less identically (although only one should have an active root partition). Again though, if I try partitioning another disk after ad0, sysinstall complains about various things and the disk does not get partitioned. Can multiple disks be partitioned in this manner or does the step have to be done as a post-install operation? ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: [Testers wanted] /dev/console cleanups
Hello Carlos, others, * Ed Schouten <[EMAIL PROTECTED]> wrote: > About the /dev/console issues: Robert Watson and I discussed this some > time ago on IRC and what I did in HEAD (not RELENG_7) was that I changed > TIOCCONS not to take a look at the permissions of /dev/console, but we > changed it to use priv_check(). This means that right now you can only > call TIOCCONS as root. I can't really understand why the problem exists > on RELENG_7. > > About making xconsole setuid: I've read the messages you mentioned, but > I think we could just alter console to call TIOCCONS and just drop > privileges. An even better solution would be to just get rid of TIOCCONS > and invent a better solution to capture syslog messages. I can't really > understand why we want to abuse TTY's to do this. > > So I can't say we're working on this, but at least I can confirm the > issue. One solution would be to let xconsole just display /var/log/messages. There shouldn't be a valid reason to let syslogd print messages to /dev/console and capture them again using TIOCCONS. We could just instruct xconsole to read its data from the log files. If you save the attached patch as /usr/ports/x11/xconsole/files/ patch-xconsole.c (create directory first) and recompile xconsole, it will use the log file. I'll discuss this with others to decide if we should take such an approach. -- Ed Schouten <[EMAIL PROTECTED]> WWW: http://80386.nl/ --- xconsole.c +++ xconsole.c @@ -145,6 +145,11 @@ {"-saveLines", "*saveLines", XrmoptionSepArg, NULL}, }; +#ifdef __FreeBSD__ +#define USE_FILE +#define FILE_NAME "/var/log/messages" +#endif + #ifdef ultrix #define USE_FILE #define FILE_NAME "/dev/xcons" @@ -252,7 +257,7 @@ if (!strcmp (app_resources.file, "console")) { /* must be owner and have read/write permission */ -#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx) && !defined(__UNIXOS2__) +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx) && !defined(__UNIXOS2__) struct stat sbuf; # if !defined (linux) if (!stat("/dev/console", &sbuf) && @@ -266,9 +271,11 @@ if (!stat(FILE_NAME, &sbuf)) # endif input = fopen (FILE_NAME, "r"); -# ifdef __UNIXOS2__ if (input) { + struct stat sbuf; + +# ifdef __UNIXOS2__ ULONG arg = 1,arglen; APIRET rc; if ((rc=DosDevIOCtl(fileno(input), 0x76,0x4d, @@ -278,8 +285,11 @@ fclose(input); input = 0; } - } # endif + + if (!fstat(fileno(input), &sbuf) && S_ISREG(sbuf.st_mode)) + regularFile = TRUE; + } #endif #ifdef USE_PTY pgpt0FzOtlKLm.pgp Description: PGP signature
RE: How can I add new binaries to the mfsroot image?
>What I've done in the past is skip sysinstall alltogether and just boot >of an NFS root. Then use custom scripts for the slicing/partitioning/ >mirroring, copy a minimal system to disk and pkg_add the rest. >Would be nice to do all this with install.cfg though. Please let me know >when you get this working. I thought of doing something like this as well. I'll have to investigate this as another option to this problem. Thanks for the feedback guys. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: How can I add new binaries to the mfsroot image?
>I believe you modify /usr/src/release/${ARCH}/boot_crunch.conf to do this. > >I haven't actually tried though... > >I think it would be possible to have a 'GEOM' menu that you can run prior to fdisk, label, etc that would allow you to >do some basic stuff like this. > >While the sysinstall code is a bit fugly it's not that difficult to hack on (speaking from limited experience :) Hmmm. I hadn't planned on actually creating a custom sysinstall but I guess that's another way we could approach this. I have some research to do... ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Ответ: KLD loading, liking
On Mon, Nov 17, 2008 at 09:43:44PM +0100, Ed Schouten wrote: > * Aleksandr Litvinov <[EMAIL PROTECTED]> wrote: > > Hello, > > You can receive a little information about KLD from the book > > "designing BSD rootkits". > > I don't own this book myself, but a colleague at Snow B.V. once showed > it to me. I only looked through it a couple of minutes, but it seemed > like a book nice to have. It also shows some techniques on how to hide > KLD's. I have this book. It shows some techniques, but it doesn't explain many things. And for KLD loading it gives only easy examples without explaining how KLD-Loader works. It's not absolutely necessary to bye this book. There are some papers, which explain the topics of the book very well: 1. Fun and Games with FreeBSD Kernel Modules http://www.r4k.net/mod/fbsdfun.html 2. Attacking FreeBSD with Kernel Modules: http://packetstormsecurity.org/papers/unix/bsdkern.htm > > -- > Ed Schouten <[EMAIL PROTECTED]> > WWW: http://80386.nl/ -- Alexej Sokolov <[EMAIL PROTECTED]> ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: How can I add new binaries to the mfsroot image?
On Mon, Nov 17, 2008 at 03:56:26PM -0800, Peter Steele typed: > >I'll have to check this out. I'm not getting anywhere with trying to > >customize mfsroot with my current approach... > > The goal we are trying to achieve btw is to make gmirror available > during an install so that the file systems are mirrored right from the > get-go, so that we can avoid having to go through the process of > converting a system as a post operation. The standard slicing/partition > commands of sysinstall do support the creation of a mirrored file system > though, so our idea was to run a script via install.cfg to take care of > fdisk/bsdlabel/gmirror phase, and then install the packages in the > normal fashion via subsequent steps in install.cfg. > > Is this something that can be done via sysinstall? If not, what's the > best alternative? This whole process is targeted to be on a PXE boot > server so we can configure our systems in a completely automated > hands-off manner. We have 200+ FreeBSD systems and we definitely need an > automated process. We already have it working fine, but without > mirroring. We can upgrade doezens of systems at a time simply by making > them boot from our PXE server. We now need to tweak this process so that > we can establish the mirrored file systems as part of the automated > install. What I've done in the past is skip sysinstall alltogether and just boot of an NFS root. Then use custom scripts for the slicing/partitioning/ mirroring, copy a minimal system to disk and pkg_add the rest. Would be nice to do all this with install.cfg though. Please let me know when you get this working. Ruben ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: How can I add new binaries to the mfsroot image?
On Tuesday 18 November 2008 10:26:26 Peter Steele wrote: > Is this something that can be done via sysinstall? If not, what's the > best alternative? This whole process is targeted to be on a PXE boot > server so we can configure our systems in a completely automated > hands-off manner. We have 200+ FreeBSD systems and we definitely need an > automated process. We already have it working fine, but without > mirroring. We can upgrade doezens of systems at a time simply by making > them boot from our PXE server. We now need to tweak this process so that > we can establish the mirrored file systems as part of the automated > install. I believe you modify /usr/src/release/${ARCH}/boot_crunch.conf to do this. I haven't actually tried though... I think it would be possible to have a 'GEOM' menu that you can run prior to fdisk, label, etc that would allow you to do some basic stuff like this. While the sysinstall code is a bit fugly it's not that difficult to hack on (speaking from limited experience :) -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C signature.asc Description: This is a digitally signed message part.