Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Gary Kline
On Sat, Dec 27, 2008 at 04:51:18AM +0200, Giorgos Keramidas wrote:
 On Fri, 26 Dec 2008 17:56:34 -0800, Gary Kline kl...@thought.org wrote:
  On Sat, Dec 27, 2008 at 03:29:05AM +0200, Giorgos Keramidas wrote:
  On Fri, 26 Dec 2008 17:13:39 -0800, Gary Kline kl...@thought.org wrote:
   is there a way i can be sure that my little C program has copied a
   dos/win file named, say, foo.htm\;7 to simply foo.htm?
  
   my program uses fopen/fgets/fputs to copy the markup files.  of the
   several i have copied, no problem.  unless i hack cmp or diff, i have
   to avoid the shell.
  
   any ideas? in other words, does anybody have a prefab cmp(oldfile,
   newfile) fn?
 
  You don't need a prefab `cmp' function, because the base system already
  includes tools that can help:
 
  cmp file1 file2 ; echo $?
  md5 file1 file2
  sha1 file1 file2
  sha256 file1 file2
 
  the problem is that there are several thousands of these files with
  dos names and an embedded '\;'7 in the file names.  the shell gets in
  the way.  i have tried
 
  sprintf(cmdbuf, /usr/bin/cmp %s %s, orig, new);
  system(cmdbuf);
 
  chokes on the embedded bytes.
 
  i'm thinking of using
 
  find . -name * -print -exec {} \;
 
  and let me program select out the file suffix.  i unlink the screwy
  dos-ish filename.  that's why i want to be sure the copied/renamed
  files are right.
 
 Use quoting (and snprintf() because it supports range-checks for the
 buffer you are passing to it):
 
 snprintf(cmdbuf, sizeof(cmdbuf), cmp \%s\ \%s\, orig, new);
 


howdy,

in a word, YES, /usr/bin/cmp saved the save before i unlinked the
oldfile.  here is the strangeness.  maybe you know, giorgos, or 
somebody else on-list.  At first--before i got smart and used your 
snprintf to simply /bin/cp and then unlink---yes, or /bin/mv, or
simply rename()--- Before, while i creating via fgets/fputs a new
file, everything went fine until i ran out of buffer space.  i
increased to buf[4096] to buf[65535].  more files were
successfully
copied from dos\;5 to .dos/*.htm, actually.  suddenly, cmp caught
a mismatch and the program exited.  a careful diff showed the err 
a something like line 3751.  my copy was missing a byte near the 
EOF:

/body/html

minus the closing 

so i upped the buffer space to 256000; same thing.  is there a lim
on the sizeof arrays, or is it [more likely] sloppy hacking?  the
size of the last file that wouldn't copy is 202K.

just wondering.

as i said, using snprintf() with quotes works, so i can do the
same with the jpeg and gif files.  just cp or mv then to a
cleaner, more rational unix-esque [[ :-) ]] name.

gary



-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 2.17a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


old flopy drive on parallel port

2008-12-27 Thread Matthias Apitz

Hello,

I've just thrown away an very old laptop which was running FreeBSD 2.2.5
in the mid of the 90's; this have had an external 3.5 inch floppy drive,
connected through a cable to the parallel port and this way fully supported,
even for the basic installation of FreeBSD which was based on making a
boot-able floppy; I saved this drive because I still have some old
floppies here around and at home no other drive to read them;

My question is: can it be used / plug'eg in without any danger into to parallel
port of my actual laptop (Fujitsu Siemens) and is this somehow still supported
in FreeBSD 7.0 as well?

Thx

matthias
-- 
Matthias Apitz
SPAMer of the year: Subject: Alle Software ist Deutsche Sprachen
From: -40 % die Neujahrsaktion gabriellekel...@grungecafe.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: OSX mount UFS

2008-12-27 Thread Martin Smith

Tsu-Fan Cheng wrote:

Hi,
I apologize for this diversion of topic. I format a external HD by
BSD and move files to it. When trying to read it on OSX, it wouldn't
recognize. Googling it didn't help much. I wonder if people here and
lend a hand. Thanks!!


Well, how is it formatted, ufs?, msdos?
When you attach it to your OSX machine, have a look at the console messages
and have a look at man mount on that machine too, that should sort it 
for you.




--
Martin
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: OSX mount UFS

2008-12-27 Thread Wojciech Puchar

I apologize for this diversion of topic. I format a external HD by
BSD and move files to it. When trying to read it on OSX, it wouldn't
recognize. Googling it didn't help much. I wonder if people here and
lend a hand. Thanks!!


Well, how is it formatted, ufs?, msdos?
When you attach it to your OSX machine, have a look at the console messages
and have a look at man mount on that machine too, that should sort it for 
you.




i don't know how different MAC-UFS is from UFS.

if too much - use FAT filesystem or just tar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Giorgos Keramidas
On Sat, 27 Dec 2008 01:40:13 -0800, Gary Kline kl...@thought.org wrote:
 howdy,

 in a word, YES, /usr/bin/cmp saved the save before i unlinked the
 oldfile.  here is the strangeness.  maybe you know, giorgos, or
 somebody else on-list.  At first--before i got smart and used your
 snprintf to simply /bin/cp and then unlink---yes, or /bin/mv, or
 simply rename()--- Before, while i creating via fgets/fputs a new
 file, everything went fine until i ran out of buffer space.  i
 increased to buf[4096] to buf[65535].  more files were successfully
 copied from dos\;5 to .dos/*.htm, actually.  suddenly, cmp caught a
 mismatch and the program exited.  a careful diff showed the err a
 something like line 3751.  my copy was missing a byte near the EOF:

 /body/html

 minus the closing 

There should be no problem when you copy a file using read() and write()
with _any_ buffer size.  Even a simple routine that reads byte by byte
and copies the file should work (a bit more of error checking is needed
wherever I have used a (void) cast but you get the idea):

#include stdio.h
#include unistd.h

/*-
 * \brief copy a file, using stdio byte-level read and writes
 *
 * Copy the `fromname' file to the `toname' file, using only fgetc()
 * and fputc() operations from stdio.  The internals of stdio are
 * free, of course, to use larger read() and write() buffers but all
 * this should be hidden from the code of copyfile().
 *
 * \param fromname  The name of the source file to copy.
 * \param tonameThe name of the destination file where
 *  `fromname' will be copied to.
 *
 * \return  Upon successful completion 0 is
 *  returned.  Otherwise, EOF is returned
 *  and the global variable errno is set to
 *  indicate the error.
 */

int
copyfile(const char *fromname, const char *toname)
{
FILE *ifp;
FILE *ofp;
int ch;

if ((ifp = fopen(fromname, rb)) == NULL)
return -1;
if ((ofp = fopen(toname, wb)) == NULL) {
(void)fclose(ifp);
return -1;
}

while ((ch = fgetc(ifp)) != EOF) {
if (fputc(ch, ofp) == EOF)
break;
}
if (ferror(ifp) != 0 || ferror(ofp) != 0) {
(void)unlink(toname);
(void)fclose(ofp);
(void)fclose(ifp);
return -1;
}

if (fclose(ofp) == EOF) {
(void)fclose(ifp);
return -1;
}
if (fclose(ifp) == EOF) {
return -1;
}

return 0;
}

So if you are seeing copy errors when you change the buffer size, you
are doing something odd with your buffers.  We would have to see the
actual code if you want more detailed help about possible buffer
handling bugs :)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Christian Laursen
Noah adm...@enabled.com writes:

 I am trying to run a shell command to the host at the far end of an ssh
 tunnel.   Here is how I structured access.  Is there any way to do this
 more compactly on one line?


 ssh -L 12345:192.168.1.20:22 n...@domain.com
 ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'

Put something like the following in your ~/.ssh/config:

Host otherhost
  HostKeyAlias otherhost
  ProxyCommand ssh n...@domain.com nc 192.168.1.20 22

Then you can simply run:

ssh otherhost 'chown -R noah:noah /shares/internal/Music/'


Reading the ssh_config man page might reveal a number of other nice
features ssh has to offer.

-- 
Christian Laursen
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Would you like to trade links?

2008-12-27 Thread Annie Simanski
Hi,

I visited your site www.freebsd.org and I'm interested in swapping 
links with you. I can add your link to a category specific page on 
our site ibrain.org, in exchange for a link back from the home or 
internal page of your site. 

If you're interested, please reply to this email with your link 
details and the URL of your links page below:

Anchor Text (example: Atlanta employment agency): 
URL: 
Description: 
Links Page:

Once I hear back from you with the following information, I'll send 
you a reply regarding our link details. Remember, we need all of the 
information above in order to post your link. I look forward to 
hearing from you.

Best regards,
Annie Simanski
Account Manager
ibrain.org

Ref: 12-26

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Lowell Gilbert
Noah adm...@enabled.com writes:

 I am trying to run a shell command to the host at the far end of an ssh
 tunnel.   Here is how I structured access.  Is there any way to do this
 more compactly on one line?


 ssh -L 12345:192.168.1.20:22 n...@domain.com
 ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'

Maybe I haven't had enough coffee yet, but wouldn't that just be
ssh n...@192.168.1.20 'chown -R noah:noah /shares/internal/Music/'
?  You might even want to use '-n' as an option to the ssh command.
-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
http://be-well.ilk.org/~lowell/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: SMP and ACPI problem ??

2008-12-27 Thread Lowell Gilbert
Alain G. Fabry alainfa...@belgacom.net writes (in *extremely* long
lines, which I wrapped for him): 

 To make a long story shorteverything worked fine on my system
 (7.0-RELEASE FreeBSD). Last night I was updating stuff on my windoswXP
 guess (under qemu) and performed a clean shutdown.

 This morning, after bringing back up my system it has been unbearably
 slow. Without doing anyting to FreeBSD, it suddenly started working in
 SMP mode - recognizing my 2 processors. Before, it never did
 this...and looking at the speed it is going now, I'm happy it didn't.

 After googling a bit, I tried to disable ACPI in order to fall back to
 single processor mode, but my system keeps acting up like it never did
 before. Very slow booting and KDM/KDE loading. Once up it's ok until I
 run a portupgrade or such.

That's weird all right.  My first guess would be interrupt problems.
vmstat(8) will show you what is happening on that front.

 1. What are some suggestions as to make it run 'normal' again?

You need to understand what's going wrong first.  

 2. Is it possible to make it actually run better in SMP mode?

Your system has an SMP kernel, I presume?  [The GENERIC kernel does,
these days.]

 3. Can my updates on the Qemu WindowsXP host make my FreeBSD system
 suddenly recognize the 2nd CPU? - this doesn't make sense to me but
 that's the only thing I worked on last night.

Vanishingly unlikely, but not completely impossible.

 I hope I can get some pointers as to what could have caused this and
 what I can do to get it back to the way it was.

I wouldn't be surprised if it were a hardware problem, which can be
tricky to trace down from the software side.

-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
http://be-well.ilk.org/~lowell/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Having issues with the nvidia driver on my box

2008-12-27 Thread Lowell Gilbert
af300...@gmail.com writes:

 For several reasons, one of which was to use the nvidia driver for my
 board, I switched from amd64 to i386. So, I installed the driver and
 although things are working I'm getting this on console 0:

 NVRM: AGP cannot be enabled on this combination of the amd CPU and OS kernel
 NVRM: kernel upgrade recommended

Do you have AGP in the kernel?

 So, when I installed the nvidia driver I said to enable AGP. (Figuring
 only  that this is an AGP board, why not?)

If you say 'no' to that, I think it will use its own AGP driver instead
of the native one.

 ps in case it matters, my board is rather old. I purchased it 4
 years ago  and as I'm not a gamer, it suffices quite nicely. Here's
 the driver I had  to install for support of this chip:

 nvidia-driver-96.43.07 NVidia graphics card binary drivers for
 hardware  OpenGL ren

What do you use NVidia's driver for?  If find that the open-source nv
driver works just fine for most things (I, too, do not play games on my
desktop computer).  Until I installed Google Earth, the proprietary
driver was completely unnecessary for me.

-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
http://be-well.ilk.org/~lowell/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: nat and ipfw, port forwarding

2008-12-27 Thread Lowell Gilbert
Richard Yang kusanagiy...@gmail.com writes:

 i have a ssh machine behind a freebsd firewall with nat and ipfw.
 how do i make port forwarding so internet can access the ssh machine?

Use 'redirect_port' with natd(8).
This is extensively documented in the Handbook:
http://www.freebsd.org/doc/en/books/handbook/network-natd.html

-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
http://be-well.ilk.org/~lowell/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: EOIP Tunnels

2008-12-27 Thread Lowell Gilbert
Marcel Grandemange thavi...@thavinci.za.net writes:

 Does FreeBSD support EOIP tunnels?

The kernel used to, and the code seems to still be around, but it may
not be used much any more.  There are netgraph nodes that you should be
able to build it out of as well.

 If so where can I find more info?

I'd look at the manuals for netgraph's Ethernet nodes, and perhaps the
GIF source code.

But I'd *really* recommend you tunnel IP rather than ethernet if you
can.  

-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
http://be-well.ilk.org/~lowell/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Matthew Seaman

Lowell Gilbert wrote:

Noah adm...@enabled.com writes:


I am trying to run a shell command to the host at the far end of an ssh
tunnel.   Here is how I structured access.  Is there any way to do this
more compactly on one line?


ssh -L 12345:192.168.1.20:22 n...@domain.com
ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'


Maybe I haven't had enough coffee yet, but wouldn't that just be
ssh n...@192.168.1.20 'chown -R noah:noah /shares/internal/Music/'
?  You might even want to use '-n' as an option to the ssh command.


ENOCOFFEE.  Your equivalence is only the case if you're already logged
into 'domain.com'  This is a fairly standard idiom for tunnelling a network
connection in through a NAT gateway or a firewall from an external Internet
site to a protected RFC 1918 internal back-end, although the forwarded protocol
is usually other than SSH.

Given that the OP is wanting to tunnel SSH through SSH, a one-liner to
achieve his desired effect might be something like:

ssh n...@domain.com ssh n...@192.168.1.20 chown -R noah:noah 
/shares/internal/Music/

Cheers,

Matthew

--
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
 Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
 Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: strange fsck results

2008-12-27 Thread Derek Ragona

At 12:37 PM 12/26/2008, re...@adeptscience.com wrote:

I am running FreeBSD 6.3 as a VMware virtual server and am getting some
strange results when I run fsck.  When I run it in multi-user mode I get
quite a few UNREF FILE errors but when I switch to single user mode
fsck does not find any errors.  Is this something I need to worry about
and if it is how might I try to get fsck to repair them?


TIA
Charlie Reese


You need to give a bit more information:  Are you running your VM under esx 
server or workstation?  What is your filesystem layout under freebsd.  What 
is the underlying server and disks you are running vmware on?


-Derek

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: nat and ipfw, port forwarding

2008-12-27 Thread usleepless
Hi Ricard,

On Fri, Dec 26, 2008 at 9:27 PM, Richard Yang kusanagiy...@gmail.comwrote:

 hi,
 i have a ssh machine behind a freebsd firewall with nat and ipfw.
 how do i make port forwarding so internet can access the ssh machine?
 thanx


i think you need to configure /etc/ipnat.conf ( read 'man ipnat' ). this is
a example definition:
rdr em1 0.0.0.0/0 port 2223 - 192.168.1.96 port 22

( this redirects incoming traffic on outside-interface em1 port 2223 to an
internal machine on port 22 )

also, include firewall_nat_enable in your rc.conf ( read 'man rc.conf' )

to configure the settings from ipnat.conf, run ipnat -C -f /etc/ipnat.conf

regards,

usleep


 --

 Best Regards

 Richard Yang
 richardy...@richardyang.net
 kusanagiy...@gmail.com
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Wireless router?

2008-12-27 Thread Mel
On Monday 22 December 2008 14:48:52 Corey Chandler wrote:
 Failing that, the
 Linksys WRT54GL isn't a half bad unit.

Yes it is a half bad unit. If you make changes to routing or firewall rules, 
you need to unplug everything, power cycle it, say a prayer and hope it 
works. I never got it working correctly at a previous location. Over here it 
works, but have no need for it anymore, since a FreeBSD wireless router is 
doing it's job.
There are many advantages of using a full-blown computer for (wireless) 
routing/nat/firewall, most notably the diagnostics that are available.

Our FreeBSD nat is using:

PPP/ADSL to provider:
f...@pci0:2:8:0:class=0x02 card=0x30138086 chip=0x24498086 
rev=0x03 hdr=0x00
vendor = 'Intel Corporation'
device = '82559ER 82559ER Integrated 10Base-T/100Base-TX Ethernet 
Controller'
class  = network
subclass   = ethernet

Wireless:
a...@pci0:2:10:0:   class=0x02 card=0x7057144f chip=0x0013168c 
rev=0x01 hdr=0x00
vendor = 'Atheros Communications Inc.'
device = 'AR5212, AR5213 802.11a/b/g Wireless Adapter'
class  = network
subclass   = ethernet

Wire, soon to be upgraded to Gbit:
x...@pci0:2:11:0:class=0x02 card=0x100010b7 chip=0x920010b7 
rev=0x78 hdr=0x00
vendor = '3COM Corp, Networking Division'
device = '3C905 CX-TX-M Fast EtherLink for PC Management NIC'
class  = network
subclass   = ethernet

ISC dhcpd, pf including altq provide the services. Currently connected with an 
Intel wpi(4), mother in law a few houses down uses some linksys card on 
windows, daughter uses a D-Link wireless with atheros chip on Kubuntu. 
Currently using WEP, but that'll change when lagg(4) will support WPA on 
wireless interfaces or when I get tired of waiting and decide to netgraph it 
myself somehow.
-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Wireless router?

2008-12-27 Thread Corey Chandler

Roger Olofsson wrote:



Corey Chandler skrev:

Nerius Landys wrote:

Thank you all for your suggestions.  This will be a project for me
over the holidays.  I decided to go the standalone wireless router
approach.  

Good man!

I will need to figure out how to configure my standalone
wireless router to pass everything through to the internal LAN that
I already have.  
It's called Bridge mode on most APs-- it does exactly what you 
describe.  Just make sure things like DHCP server are turned off or 
you'll see some... odd breakages.

Also I don't know too much about security, like how
to prevent eavesdroppers from connecting to my internal network.  One
of you mentioned access lists, and I assume that means I tell the
wireless router which MAC addresses it accepts, and nothing else.  
Ugh.  MAC addresses are trivial to spoof-- I usually don't bother 
with using them for security, although I do use 'em to ensure that 
particular machines always inherit particular addresses.



Is there any other way to provide security?  Like a password-protected
network?  What are the buzzwords for these security schemes?  Which
security scheme do you recommend for preventing random people within
proximity from connecting to my internal netowrk?
  


Absolutely.  Google for WPA or WPA2; WEP has been broken and is 
trivial to bruteforce, so I'd not bother with that.


Once you get the unit in, feel free to email me off list for 
configuration questions; it sounds like a fun project!


-- CJC
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org






No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus 
Database: 270.10.0/1861 - Release Date: 2008-12-22 11:23




Hello Corey,

I don't use 'bridge mode'. I set a normal LAN ip for the wifi router - 
as well as ips to the FreeBSD gateway and dns. This is for the LAN 
part of the router - then another internal LAN ip for the wifi part.


To examplify.

Wifi router LAN part - ip 192.168.0.20, gateway 192.168.0.1, dns 
192.168.0.10 and 192.168.0.11.


Wifi wifi part - network 10.0.0.1 - 10.0.0.10.
The problem with doing that is a lot of systems start throwing weird 
errors in a double NAT environment.   I'd probably avoid that step and 
restrict wireless to its own VLAN if I were to go that route...

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Default list of exported variables in sh(1) - $HOSTNAME

2008-12-27 Thread Mel
On Wednesday 24 December 2008 10:22:34 Brian A. Seklecki wrote:
 All:

 I've got a fun problem ...

 I'm having trouble tracking down where the default list of exported
 variables is set for sh(1).

 I've got a piece of PHP code that runs on GNU/Linux but not FreeBSD
 because (I think) $HOSTNAME is exported by default.

 The PHP CLI calls $_ENV[HOSTNAME], which under GNU/Linux returns:

 $ php -r 'print gethostbyaddr(gethostbyname($_ENV[HOSTNAME]))'
 soundwave.wscollaborativefusion.com

 In HTTP/CGI mode, I can call $_SERVER[]. But $_ENV[] should work in both
 CLI and HTTP mode.

 However, because Apache is spawned from sh(1) from rc(8) and in FreeBSD
 6.x, $HOSTNAME is not exported by default, which is what $_ENV[] uses
 (getenv()):

 $ uname -a
 FreeBSD bdb00 6.3-RELEASE-p2
 $ export
 SSH_CLIENT
 USER
 MAIL
 HOME
 SSH_TTY
 PAGER
 ENV
 LOGNAME
 BLOCKSIZE
 TERM
 PATH
 SHELL
 SSH_CONNECTION
 FTP_PASSIVE_MODE
 EDITOR

I suspect linux to set them from .profile files (even /etc/profile) and not 
hardcoded in a shell or login program. The default skeletons 
in /usr/share/skel on FreeBSD does not set them. Neither 
does /etc/login.conf.
I would set it in /etc/profile.

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Wireless router?

2008-12-27 Thread Corey Chandler

Mel wrote:

On Monday 22 December 2008 14:48:52 Corey Chandler wrote:
  

Failing that, the
Linksys WRT54GL isn't a half bad unit.



Yes it is a half bad unit. 


Absolutely-- if you're running out of the box firmware.  I use DD-WRT or 
Tomato specifically to get around the issues you describe.  The reason I 
go for the GL is that it's a more robust platform than their standard 
wrt-54g, which for some ungodly reason they started stripping flash and 
processing power out of after their switch to VxWorks.


--CJC
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: 3ware array access lock up on 7.1-RC

2008-12-27 Thread Mel
On Friday 26 December 2008 08:12:49 Artem Kuchin wrote:
 I am not even sure that it is related to freebsd, but maybe someone could
 point out the problem.

 We wanted to upgrade our hosting server from
 FreeBSD 6.2, 3ware 8506-4LP SATA RAID, raid 5
 to
 FreeBSD 7.1 (RC for now), 9550SXU-4LP, raid 10

 We have tested the new installation on ASUS P5K WS motherboard
 with PCI-X slot while the server kept running.

 The server has Supermicro X5DPE-G2  (pretty old one, 2004).

 So, when everything was ready, i just took out the old controller and
 disks and installed the new controller and the array disks.

 The system booted up, but when i started very intense file operations
 the file
 system just froze. The weird thing is that any open program which does
 not use
 filesystem kept running fine. For example, i could type and edit in open
 ee editor,
 but copying progress bar in midnight commander just stood still. If i
 tried to save file
 or open file or do anything disk related from ee in another console the
 program froze too,
 apparently waiting for disk system to reply forever (i tried waiting for
 20 minutes).
 I could even connect to ssh port, but it does not auth because sshd
 needs to read something
 from the disk.
 I put everything back into Asus P5K WS and tested it. Everything worked
 fine again.

 Any idea what might going on here?

OS bugs aside, a dead disk that keeps getting IO request explains all 
symptoms. Dead can also mean, faulty cable, buggy connector. I would expect 
the hardware raid controller to pick up on it though and remove it from the 
array.

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Wireless router?

2008-12-27 Thread Bruce Cran
On Sat, 27 Dec 2008 11:27:56 -0800
Corey Chandler li...@sequestered.net wrote:

 Mel wrote:
  On Monday 22 December 2008 14:48:52 Corey Chandler wrote:

  Failing that, the
  Linksys WRT54GL isn't a half bad unit.
  
 
  Yes it is a half bad unit. 
 
 Absolutely-- if you're running out of the box firmware.  I use DD-WRT
 or Tomato specifically to get around the issues you describe.  The
 reason I go for the GL is that it's a more robust platform than their
 standard wrt-54g, which for some ungodly reason they started
 stripping flash and processing power out of after their switch to
 VxWorks.

Probably because they realised they could get away with less memory and
a slower CPU because code runs more efficiently on VxWorks vs. Linux
on the same hardware.  Of course it also provides fewer features than
Linux, so I'd prefer a Linux-based router over VxWorks.

-- 
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Wireless router?

2008-12-27 Thread Roger Olofsson



Corey Chandler skrev:

Roger Olofsson wrote:



Corey Chandler skrev:

Nerius Landys wrote:

Thank you all for your suggestions.  This will be a project for me
over the holidays.  I decided to go the standalone wireless router
approach.  

Good man!

I will need to figure out how to configure my standalone
wireless router to pass everything through to the internal LAN that
I already have.  
It's called Bridge mode on most APs-- it does exactly what you 
describe.  Just make sure things like DHCP server are turned off or 
you'll see some... odd breakages.

Also I don't know too much about security, like how
to prevent eavesdroppers from connecting to my internal network.  One
of you mentioned access lists, and I assume that means I tell the
wireless router which MAC addresses it accepts, and nothing else.  
Ugh.  MAC addresses are trivial to spoof-- I usually don't bother 
with using them for security, although I do use 'em to ensure that 
particular machines always inherit particular addresses.



Is there any other way to provide security?  Like a password-protected
network?  What are the buzzwords for these security schemes?  Which
security scheme do you recommend for preventing random people within
proximity from connecting to my internal netowrk?
  


Absolutely.  Google for WPA or WPA2; WEP has been broken and is 
trivial to bruteforce, so I'd not bother with that.


Once you get the unit in, feel free to email me off list for 
configuration questions; it sounds like a fun project!


-- CJC
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org






No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus 
Database: 270.10.0/1861 - Release Date: 2008-12-22 11:23




Hello Corey,

I don't use 'bridge mode'. I set a normal LAN ip for the wifi router - 
as well as ips to the FreeBSD gateway and dns. This is for the LAN 
part of the router - then another internal LAN ip for the wifi part.


To examplify.

Wifi router LAN part - ip 192.168.0.20, gateway 192.168.0.1, dns 
192.168.0.10 and 192.168.0.11.


Wifi wifi part - network 10.0.0.1 - 10.0.0.10.
The problem with doing that is a lot of systems start throwing weird 
errors in a double NAT environment.   I'd probably avoid that step and 
restrict wireless to its own VLAN if I were to go that route...

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org





No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.176 / Virus Database: 270.10.0/1865 - Release Date: 2008-12-26 13:01





Hello Corey,

There is no double NAT involved.

/Roger

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Perl 5.10?

2008-12-27 Thread Mel
On Tuesday 23 December 2008 03:27:19 Jerry wrote:

 Since it does seem to work quite well under Linux, I was wondering
 if there was some fundamental flaw in FBSD that prevented it from
 working correctly here. Even so, failing to get  a major project like
 Perl running properly in over a year on FBSD does not bode well for the
 OS.

Aside from the rest said in this thread, maybe you should consider the fact 
that it's a cross platform scripting language's responsibility to provide 
compatibility for the operating system, not the other way around.
Also, Perl should really be cremated already, but you can file that 
under 'opinion'.

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Having issues with the nvidia driver on my box

2008-12-27 Thread Michael Powell
Lowell Gilbert wrote:

 af300...@gmail.com writes:
 
 For several reasons, one of which was to use the nvidia driver for my
 board, I switched from amd64 to i386. So, I installed the driver and
 although things are working I'm getting this on console 0:

 NVRM: AGP cannot be enabled on this combination of the amd CPU and OS
 kernel NVRM: kernel upgrade recommended
 
 Do you have AGP in the kernel?
 
 So, when I installed the nvidia driver I said to enable AGP. (Figuring
 only  that this is an AGP board, why not?)
 
 If you say 'no' to that, I think it will use its own AGP driver instead
 of the native one.

This reminds me of a situation I had on an old KT-400a chipset. Some
VIA chipsets had a weak signal condition on one of the AGP pins. The
way to make it work was to remove device agp from the kernel, install
the nvidia-drivers, and place Option NvAgp 1 in the xorg.conf.

I do not believe the OP scenario is a match, as his is working while
mine would only show colored bars and trash on the screen. I don't
recall which is the default, but here are the options available:
Option NvAgp 0 Disable AGP
Option NvAgp 1 Use NVIDIA's AGP GART Driver
Option NvAgp 2 Use the OS AGP GART driver (agp.ko)
Option NvAgp 3 Attempt 2, fall back to 1

Perhaps placing an appropriate choice in Section Device will
nuke the error message. The OP can probably discern which AGP
is being used from the Xorg.0.log file and choose accordingly.

 
 ps in case it matters, my board is rather old. I purchased it 4
 years ago  and as I'm not a gamer, it suffices quite nicely. Here's
 the driver I had  to install for support of this chip:

 nvidia-driver-96.43.07 NVidia graphics card binary drivers for
 hardware  OpenGL ren
[snip]

The nvidia-driver ports being broken up into sub-ports because NVidia
broke their monolithic into Legacy or New necessitates the need
to dig out of the comments in the Makefiles which port matches which
hardware. Since the above mentioned version rev matches one of the
port installs I am going to just assume that it is the right one - after
all it probably wouldn't work at all if it wasn't.

-Mike



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

I discovered that open syscall with only O_APPEND fails with
permission denied if an user does not have rights to write to a file
(what is normal) even if it is root (what is a surprise). For example,
if I have a file owned by www:www and with 644 permissions root cannot
do open(testfile, O_APPEND) call. If I change ownership of I change
permission to for example 666, call succeedes.

This works on Linux (Debian). So this is a feature? Or a bug?

(I discovered that because htpasswd failed to add new
username/password pair (ran as root) to a file owner by www.)

Checked on FreeBSD 7.0-STABLE.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Noah

Christian Laursen wrote:

Noah adm...@enabled.com writes:


I am trying to run a shell command to the host at the far end of an ssh
tunnel.   Here is how I structured access.  Is there any way to do this
more compactly on one line?


ssh -L 12345:192.168.1.20:22 n...@domain.com
ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'


Put something like the following in your ~/.ssh/config:

Host otherhost
  HostKeyAlias otherhost
  ProxyCommand ssh n...@domain.com nc 192.168.1.20 22

Then you can simply run:

ssh otherhost 'chown -R noah:noah /shares/internal/Music/'



I cant do this since I need to reach a publicly addressable host before 
reaching the server at 192.168.1.20







Reading the ssh_config man page might reveal a number of other nice
features ssh has to offer.



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Noah

Lowell Gilbert wrote:

Noah adm...@enabled.com writes:


I am trying to run a shell command to the host at the far end of an ssh
tunnel.   Here is how I structured access.  Is there any way to do this
more compactly on one line?


ssh -L 12345:192.168.1.20:22 n...@domain.com
ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'


Maybe I haven't had enough coffee yet, but wouldn't that just be
ssh n...@192.168.1.20 'chown -R noah:noah /shares/internal/Music/'
?  You might even want to use '-n' as an option to the ssh command.




I cant do this since I need to reach a publicly addressable host before 
reaching the server at 192.168.1.20 .  Therefore I am under the 
impression I need to tunnel through the publicly addressed host first 
then I can ssh to 192.168.1.20 .

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Noah

Matthew Seaman wrote:

Lowell Gilbert wrote:

Noah adm...@enabled.com writes:


I am trying to run a shell command to the host at the far end of an ssh
tunnel.   Here is how I structured access.  Is there any way to do this
more compactly on one line?


ssh -L 12345:192.168.1.20:22 n...@domain.com
ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'


Maybe I haven't had enough coffee yet, but wouldn't that just be
ssh n...@192.168.1.20 'chown -R noah:noah /shares/internal/Music/'
?  You might even want to use '-n' as an option to the ssh command.


ENOCOFFEE.  Your equivalence is only the case if you're already logged
into 'domain.com'  This is a fairly standard idiom for tunnelling a network
connection in through a NAT gateway or a firewall from an external Internet
site to a protected RFC 1918 internal back-end, although the forwarded 
protocol

is usually other than SSH.

Given that the OP is wanting to tunnel SSH through SSH, a one-liner to
achieve his desired effect might be something like:

ssh n...@domain.com ssh n...@192.168.1.20 chown -R noah:noah 
/shares/internal/Music/



you will the prize.   please retrieve it on the way out. :)




Cheers,

Matthew



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Gary Kline
On Sat, Dec 27, 2008 at 02:58:06PM +0200, Giorgos Keramidas wrote:
 On Sat, 27 Dec 2008 01:40:13 -0800, Gary Kline kl...@thought.org wrote:
  howdy,
 
  in a word, YES, /usr/bin/cmp saved the save before i unlinked the
  oldfile.  here is the strangeness.  maybe you know, giorgos, or
  somebody else on-list.  At first--before i got smart and used your
  snprintf to simply /bin/cp and then unlink---yes, or /bin/mv, or
  simply rename()--- Before, while i creating via fgets/fputs a new
  file, everything went fine until i ran out of buffer space.  i
  increased to buf[4096] to buf[65535].  more files were successfully
  copied from dos\;5 to .dos/*.htm, actually.  suddenly, cmp caught a
  mismatch and the program exited.  a careful diff showed the err a
  something like line 3751.  my copy was missing a byte near the EOF:
 
  /body/html
 
  minus the closing 


Your code copies flawlessly.  I noticed late last night that
cmp uses the same byte-by-byte cp and IIRC checks each  to
make certain they bytes are identical.  My copyFile()
function simply used fopen, fgets, and fputs.  I yanked it
from a program that copied files from ~/Mail where the lines
were around 80 bytes  rather than in the thousands.  With few
newlines.   The gotcha got me, in other words!  Thanks much
for the function!

gary

 
 There should be no problem when you copy a file using read() and write()
 with _any_ buffer size.  Even a simple routine that reads byte by byte
 and copies the file should work (a bit more of error checking is needed
 wherever I have used a (void) cast but you get the idea):
 
 #include stdio.h
 #include unistd.h
 
 /*-
  * \brief copy a file, using stdio byte-level read and writes
  *
  * Copy the `fromname' file to the `toname' file, using only fgetc()
  * and fputc() operations from stdio.  The internals of stdio are
  * free, of course, to use larger read() and write() buffers but all
  * this should be hidden from the code of copyfile().
  *
  * \param fromname  The name of the source file to copy.
  * \param tonameThe name of the destination file where
  *  `fromname' will be copied to.
  *
  * \return  Upon successful completion 0 is
  *  returned.  Otherwise, EOF is returned
  *  and the global variable errno is set to
  *  indicate the error.
  */
 
 int
 copyfile(const char *fromname, const char *toname)
 {
 FILE *ifp;
 FILE *ofp;
 int ch;
 
 if ((ifp = fopen(fromname, rb)) == NULL)
 return -1;
 if ((ofp = fopen(toname, wb)) == NULL) {
 (void)fclose(ifp);
 return -1;
 }
 
 while ((ch = fgetc(ifp)) != EOF) {
 if (fputc(ch, ofp) == EOF)
 break;
 }
 if (ferror(ifp) != 0 || ferror(ofp) != 0) {
 (void)unlink(toname);
 (void)fclose(ofp);
 (void)fclose(ifp);
 return -1;
 }
 
 if (fclose(ofp) == EOF) {
 (void)fclose(ifp);
 return -1;
 }
 if (fclose(ifp) == EOF) {
 return -1;
 }
 
 return 0;
 }
 
 So if you are seeing copy errors when you change the buffer size, you
 are doing something odd with your buffers.  We would have to see the
 actual code if you want more detailed help about possible buffer
 handling bugs :)


I'll grep -r thru /usr/src to see if any utility actually
does use my shortcut!  ...Somehow I doubt it.

gary


 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 2.17a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: running shell command through ssh tunnel

2008-12-27 Thread Christian Laursen
Noah adm...@enabled.com writes:

 Christian Laursen wrote:
 Noah adm...@enabled.com writes:

 I am trying to run a shell command to the host at the far end of an ssh
 tunnel.   Here is how I structured access.  Is there any way to do this
 more compactly on one line?


 ssh -L 12345:192.168.1.20:22 n...@domain.com
 ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'

 Put something like the following in your ~/.ssh/config:

 Host otherhost
   HostKeyAlias otherhost
   ProxyCommand ssh n...@domain.com nc 192.168.1.20 22

 Then you can simply run:

 ssh otherhost 'chown -R noah:noah /shares/internal/Music/'


 I cant do this since I need to reach a publicly addressable host
 before reaching the server at 192.168.1.20

Yes, that's exactly what it does.

Try reading the mail one more time and look up how ProxyCommand
works...

-- 
Christian Laursen
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Giorgos Keramidas
On Sat, 27 Dec 2008 13:35:51 -0800, Gary Kline kl...@thought.org wrote:
 On Sat, Dec 27, 2008 at 02:58:06PM +0200, Giorgos Keramidas wrote:
 On Sat, 27 Dec 2008 01:40:13 -0800, Gary Kline kl...@thought.org wrote:
  howdy,
 
  in a word, YES, /usr/bin/cmp saved the save before i unlinked the
  oldfile.  here is the strangeness.  maybe you know, giorgos, or
  somebody else on-list.  At first--before i got smart and used your
  snprintf to simply /bin/cp and then unlink---yes, or /bin/mv, or
  simply rename()--- Before, while i creating via fgets/fputs a new
  file, everything went fine until i ran out of buffer space.  i
  increased to buf[4096] to buf[65535].  more files were successfully
  copied from dos\;5 to .dos/*.htm, actually.  suddenly, cmp caught a
  mismatch and the program exited.  a careful diff showed the err a
  something like line 3751.  my copy was missing a byte near the EOF:
 
  /body/html
 
  minus the closing 

 Your code copies flawlessly.  I noticed late last night that cmp uses
 the same byte-by-byte cp and IIRC checks each to make certain they
 bytes are identical.  My copyFile() function simply used fopen, fgets,
 and fputs.  I yanked it from a program that copied files from ~/Mail
 where the lines were around 80 bytes rather than in the thousands.
 With few newlines.  The gotcha got me, in other words!  Thanks much
 for the function!

That's good news, because I didn't even compile it.  I just wrote it in
my mailer and hit send.  I'm glad it worked :)

For what it's worth, if you are not handling *text* files, fgets() and
fputs() are probably a bad idea.  They are line oriented, and they
depend on the presence of '\n' characters.  The concept of ``lines'' is,
at best, ill defined for binary files.  So it makes more sense to use
either byte-for-byte copies and rely on stdio to do buffering, or to use
some sort of custom buffer and fread()/fwrite() or plain read()/write().

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: ports-mgmt/portmaster question

2008-12-27 Thread Mel
On Wednesday 24 December 2008 03:35:07 Matthew Seaman wrote:
 B. Cook wrote:
  Is there a way to pass make args (other than -m) for each port?
 

...

 If you want options that only apply to specific ports, then you can use
 a construct like this:

 .if ${.CURDIR:M*/databases/mysql*}
 WITH_CHARSET=utf8
 WITH_XCHARSET=none
 WITH_COLLATION=utf8_unicode_ci
 WITH_OPENSSL=yes
 BUILD_OPTIMIZED=yes
 WITH_INNODB=yes
 WITH_ARCHIVE=yes
 WITH_FEDERATED=yes
 WITH_NDB=yes
 WITH_CSV=yes
 WITH_SPHINXSE=yes
 .endif

Or, so you don't have one blobby make.conf that needs to be read for 
everything that uses FreeBSD's make, you can make a file called 
Makefile.local in the port's directory and set these.
There are only a few special cases in which this won't work, because it is 
included at the bottom of the port's Makefile, but then you can resort 
to /etc/make.conf.

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


The FreeBSD Diary: 2008-12-07 - 2008-12-27

2008-12-27 Thread Dan Langille
The FreeBSD Diary contains a large number of practical 
examples and how-to guides.  This message is posted weekly
to freebsd-questions@freebsd.org with the aim of letting people
know what's available on the website.  Before you post a question
here it might be a good idea to first search the mailing list 
archives http://www.freebsd.org/search/search.html#mailinglists 
and/or The FreeBSD Diary http://www.freebsddiary.org/. 


-- 
Dan Langille
BSDCan - http://www.BSDCan.org/ - BSD Conference

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mel
On Saturday 27 December 2008 11:46:03 Mitar wrote:
 Hi!

 I discovered that open syscall with only O_APPEND fails with
 permission denied if an user does not have rights to write to a file
 (what is normal) even if it is root (what is a surprise). For example,
 if I have a file owned by www:www and with 644 permissions root cannot
 do open(testfile, O_APPEND) call. If I change ownership of I change
 permission to for example 666, call succeedes.

 This works on Linux (Debian). So this is a feature? Or a bug?

 (I discovered that because htpasswd failed to add new
 username/password pair (ran as root) to a file owner by www.)

 Checked on FreeBSD 7.0-STABLE.

Can't reproduce:

$ ls -al test.txt
-rw-r--r--  1 www  www  33 Dec 27 15:12 test.txt

$ sudo ./open
test.txt opened as fd 3

$ cat test.txt
this file
cannot be appended to

$ cat -n open.c
 1  #include sys/types.h
 2  #include sys/uio.h
 3  #include unistd.h
 4  #include stdio.h
 5  #include fcntl.h
 6  #include err.h
 7  #include sysexits.h
 8
 9  int main(void)
10  {
11  const char fname[] = test.txt;
12  const char txt[] = cannot be appended to\n;
13  int fd;
14
15  fd = open(fname, O_WRONLY|O_APPEND);
16  if( fd  0 )
17  err(EX_NOINPUT, Failed to open %s, fname);
18
19  printf(%s opened as fd %i\n, fname, fd);
20  if( write(fd, txt, sizeof(txt))  0 )
21  err(EX_DATAERR, write());
22  close(fd);
23  return EX_OK;
24  }

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Wireless router?

2008-12-27 Thread Mario Lobo
On Saturday 27 December 2008 16:49:54 Roger Olofsson wrote:
 Corey Chandler skrev:
  Roger Olofsson wrote:
  Corey Chandler skrev:
  Nerius Landys wrote:
  Thank you all for your suggestions.  This will be a project for me
  over the holidays.  I decided to go the standalone wireless router
  approach.
 
  Good man!
 
  I will need to figure out how to configure my standalone
  wireless router to pass everything through to the internal LAN that
  I already have.
 
  It's called Bridge mode on most APs-- it does exactly what you
  describe.  Just make sure things like DHCP server are turned off or
  you'll see some... odd breakages.
 
  Also I don't know too much about security, like how
  to prevent eavesdroppers from connecting to my internal network.  One
  of you mentioned access lists, and I assume that means I tell the
  wireless router which MAC addresses it accepts, and nothing else.
 
  Ugh.  MAC addresses are trivial to spoof-- I usually don't bother
  with using them for security, although I do use 'em to ensure that
  particular machines always inherit particular addresses.
 
  Is there any other way to provide security?  Like a password-protected
  network?  What are the buzzwords for these security schemes?  Which
  security scheme do you recommend for preventing random people within
  proximity from connecting to my internal netowrk?
 
  Absolutely.  Google for WPA or WPA2; WEP has been broken and is
  trivial to bruteforce, so I'd not bother with that.
 
  Once you get the unit in, feel free to email me off list for
  configuration questions; it sounds like a fun project!
 
  -- CJC
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to
  freebsd-questions-unsubscr...@freebsd.org
 
 
  ---
 -
 
 
  No virus found in this incoming message.
  Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus
  Database: 270.10.0/1861 - Release Date: 2008-12-22 11:23
 
  Hello Corey,
 
  I don't use 'bridge mode'. I set a normal LAN ip for the wifi router -
  as well as ips to the FreeBSD gateway and dns. This is for the LAN
  part of the router - then another internal LAN ip for the wifi part.
 
  To examplify.
 
  Wifi router LAN part - ip 192.168.0.20, gateway 192.168.0.1, dns
  192.168.0.10 and 192.168.0.11.
 
  Wifi wifi part - network 10.0.0.1 - 10.0.0.10.
 
  The problem with doing that is a lot of systems start throwing weird
  errors in a double NAT environment.   I'd probably avoid that step and
  restrict wireless to its own VLAN if I were to go that route...
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to
  freebsd-questions-unsubscr...@freebsd.org
 
 
  
 
 
  No virus found in this incoming message.
  Checked by AVG - http://www.avg.com
  Version: 8.0.176 / Virus Database: 270.10.0/1865 - Release Date:
  2008-12-26 13:01

 Hello Corey,

 There is no double NAT involved.

 /Roger

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 freebsd-questions-unsubscr...@freebsd.org

That's correct. I have a D-link WBR-1310 here at home. Don't know if it's a 
bad or hip piece. I only know it was inside my budget and it does its job 
perfectly. 

Like I said on my first post to this thread, The WAN port is not used, hence 
no NAT inside the unit. Configured its LAN port ip with one of my LAN, 
plugged it to the switch, enabled WAP2 and assign a free LAN ip to any 
wireless device I want to allow on our home (plus the WAP key, of 
course).Voila, access point.

IF DHCP is wanted, I can use the unit's own but since its only one laptop I 
assigned a static IP to it.

The only NAT happens on the freebsd machine.

Don't know about the reputation of the Linksys WRT54GL. The only one I've 
tried I borrowed from a friend and worked very nicely also.
-- 
Mario Lobo
http://www.mallavoodoo.com.br
FreeBSD since version 2.2.8 [not Pro-Audio YET!!] (99,7% winedows FREE)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: nat and ipfw, port forwarding

2008-12-27 Thread Richard Yang
thank you, usleep (nice name)i somehow made it work by
1. add redirect_port udp 10.0.0.200:5 5 in natd.conf
2. allow all traffic and diversion in ipfw.rules

i tried to limit the traffic by modifying the rules in ipfw.rules,
but unsuccessfully. so i just leave it be at this moment.
i am very confused by the roles of natd and ipfw, and how they should work
together.

rich


On Sat, Dec 27, 2008 at 8:40 AM, usleepl...@gmail.com wrote:

 Hi Ricard,

 On Fri, Dec 26, 2008 at 9:27 PM, Richard Yang kusanagiy...@gmail.comwrote:

 hi,
 i have a ssh machine behind a freebsd firewall with nat and ipfw.
 how do i make port forwarding so internet can access the ssh machine?
 thanx


 i think you need to configure /etc/ipnat.conf ( read 'man ipnat' ). this is
 a example definition:
 rdr em1 0.0.0.0/0 port 2223 - 192.168.1.96 port 22

 ( this redirects incoming traffic on outside-interface em1 port 2223 to an
 internal machine on port 22 )

 also, include firewall_nat_enable in your rc.conf ( read 'man rc.conf' )

 to configure the settings from ipnat.conf, run ipnat -C -f
 /etc/ipnat.conf

 regards,

 usleep




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Gary Kline
On Sat, Dec 27, 2008 at 11:58:35PM +0200, Giorgos Keramidas wrote:
 On Sat, 27 Dec 2008 13:35:51 -0800, Gary Kline kl...@thought.org wrote:
  On Sat, Dec 27, 2008 at 02:58:06PM +0200, Giorgos Keramidas wrote:
  On Sat, 27 Dec 2008 01:40:13 -0800, Gary Kline kl...@thought.org wrote:
 

[[ save the electrons!]]

  Your code copies flawlessly.  I noticed late last night that cmp uses
  the same byte-by-byte cp and IIRC checks each to make certain they
  bytes are identical.  My copyFile() function simply used fopen, fgets,
  and fputs.  I yanked it from a program that copied files from ~/Mail
  where the lines were around 80 bytes rather than in the thousands.
  With few newlines.  The gotcha got me, in other words!  Thanks much
  for the function!
 
 That's good news, because I didn't even compile it.  I just wrote it in
 my mailer and hit send.  I'm glad it worked :)
 
 For what it's worth, if you are not handling *text* files, fgets() and
 fputs() are probably a bad idea.  They are line oriented, and they
 depend on the presence of '\n' characters.  The concept of ``lines'' is,
 at best, ill defined for binary files.  So it makes more sense to use
 either byte-for-byte copies and rely on stdio to do buffering, or to use
 some sort of custom buffer and fread()/fwrite() or plain read()/write().
 

Just got up from a nap [ and *coffee*].  Still, after last
night's until past 03.30 with TWO giggling teenagers, god
help me:)  --never had sleepover when i was 13--  Anyway,
your comment about writing that from scratch brought to mind
something I've been pondering recently.   I already have
several kinds of main() functions that let you go in various
directions.  Input by re-direction, input from the cmdline,
even both.  These save me typing maybe 20 to 50 lines.  If
you enjoy typing and rewriting code rom scratch a zillion
times, fine, but at least I would rather use my ``prefab''
main()'s.

I also have some very simple and efficient string-matching
functions [[ for SHORT lines!! ]] and other thing we do very
often.  It was (is?) throw-away code.  Does it made sense to
have a place on the web where you can get these kind of
canned functions?  I have perhaps 20 of these functions named
and tagged.  This was, I believe, at least one idea behind
C++, but at least I  have never seen any sites that offer C
or C++ functions to do ``X''.

gary



-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 2.17a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Giorgos Keramidas
On Sat, 27 Dec 2008 17:49:03 -0800, Gary Kline kl...@thought.org wrote:
 I also have some very simple and efficient string-matching
 functions [[ for SHORT lines!! ]] and other thing we do very often.
 It was (is?)  throw-away code.  Does it made sense to have a place
 on the web where you can get these kind of canned functions?  I
 have perhaps 20 of these functions named and tagged.  This was, I
 believe, at least one idea behind C++, but at least I have never
 seen any sites that offer C or C++ functions to do ``X''.

There have been efforts in the past to do something like this.

For example, I still remember discovering 'clib' at

  http://mapage.noos.fr/emdel/clib.htm

a few years ago.

It seems a nice idea to build a personal toolset, but my impression
is that dumping a bunch of functions on a web page is not enough
anymore.  The world has been `spoiled' by open source projects, so if
an effort like this expects to be taken seriously from the world, it
should at least have:

  * A public source repository, with full history, readable from
everyone and compatible with one of the Open Source SCM tools.

  * At least one mailing list for questions  announcements of new
releases.

  * At least one visibly active maintainer, who is willing to fix
bugs, reply to email questions, and perform other `benevolent
dictator' tasks.

  * Up to date manpages for all the functions in the collection.

This sounds like a lot of work, because it *is*.  That's the price of
writing something that others may want to use though.  Otherwise
everyone can use the GNU glib and their system libc.so library :)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


cdrom restatus

2008-12-27 Thread edmund jones
Hello Happy Holidays!

Hope you had a great new years. 
Im just writing cause I have a little problem. I must have made an adjustment 
while trying to round out the compatibility of the jdk.  I guess to the 
parameter node of fstab and or /dev.  Now when I try to load the cdrom from any 
where I get ...kernel cannot have more than 32 cdrom devices.
Im stumped. Though, I just checked the site and found a little data. 
However could you offer any way to remove the 32 cd - cause -df does not show 
any loaded. I'll fiddle with the -o and make sure Im syntax ok. but if you 
had to quess -??   Please contact Thanks.  


  
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how can i be certain that a file has copied exactly?

2008-12-27 Thread Gary Kline
On Sun, Dec 28, 2008 at 04:06:28AM +0200, Giorgos Keramidas wrote:
 On Sat, 27 Dec 2008 17:49:03 -0800, Gary Kline kl...@thought.org wrote:
  I also have some very simple and efficient string-matching
  functions [[ for SHORT lines!! ]] and other thing we do very often.
  It was (is?)  throw-away code.  Does it made sense to have a place
  on the web where you can get these kind of canned functions?  I
  have perhaps 20 of these functions named and tagged.  This was, I
  believe, at least one idea behind C++, but at least I have never
  seen any sites that offer C or C++ functions to do ``X''.
 
 There have been efforts in the past to do something like this.
 
 For example, I still remember discovering 'clib' at
 
   http://mapage.noos.fr/emdel/clib.htm
 
 a few years ago.
 
 It seems a nice idea to build a personal toolset, but my impression
 is that dumping a bunch of functions on a web page is not enough
 anymore.  The world has been `spoiled' by open source projects, so if
 an effort like this expects to be taken seriously from the world, it
 should at least have:
 
   * A public source repository, with full history, readable from
 everyone and compatible with one of the Open Source SCM tools.
 
   * At least one mailing list for questions  announcements of new
 releases.
 
   * At least one visibly active maintainer, who is willing to fix
 bugs, reply to email questions, and perform other `benevolent
 dictator' tasks.
 
   * Up to date manpages for all the functions in the collection.
 
 This sounds like a lot of work, because it *is*.  That's the price of
 writing something that others may want to use though.  Otherwise
 everyone can use the GNU glib and their system libc.so library :)
 


:-)

Well, I knew if I asked around and the right places, that
eventually i'd get an intelligent answer.  When I began
labeling and tagging my few fn's, i realized how much work it
was ... and that is just for us BSD'ers.  It wouldn't work on
other systems--at least not the driver side.  But that was
never my primary thought.  I was thinking more of the
application area; code that you use maybe for a few hours or
days, then pitch.  Or maybe tarbar with bzip.

Could this be the next hundred-thousand-dollar idea?  [I'd
say $million, but not with the global *D*epression we may be
heading into/toward.  Seriously.  

I realize that corporation ABC wants to wipe away corporation
XYZ, say, but having this global, completely free/open source
site would help both equally.  Seems to me this kind of site
would benefit everybody and harm no one.  So the
maintainer/dictator would probably have to be paid.  Or else
get a free honey-glazed ham on New Years.  

I'll check out glib.  Meanwhile there is publib.  It has some 
pretty useful functions, some of whic h I had to do the hard
way, then found that liw had already done them.

gary


 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 2.17a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

On Sun, Dec 28, 2008 at 1:17 AM, Mel
fbsd.questi...@rachie.is-a-geek.net wrote:
15  fd = open(fname, O_WRONLY|O_APPEND);

Try only with O_APPEND, without O_WRONLY.

I have just found a bug report about that:

https://issues.apache.org/bugzilla/show_bug.cgi?id=45923

But the question remains: why this fails? It works on Linux, as it is
seen from bug report it works also on FreeBSD 6.x, why it does not
work anymore on FreeBSD 7.x? Is it correct that it does not work? I
have not found anywhere written that O_WRONLY should be specified with
O_APPEND.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Gary Kline
On Sun, Dec 28, 2008 at 04:16:41AM +0100, Mitar wrote:
 Hi!
 
 On Sun, Dec 28, 2008 at 1:17 AM, Mel
 fbsd.questi...@rachie.is-a-geek.net wrote:
 15  fd = open(fname, O_WRONLY|O_APPEND);
 
 Try only with O_APPEND, without O_WRONLY.
 
 I have just found a bug report about that:
 
 https://issues.apache.org/bugzilla/show_bug.cgi?id=45923
 
 But the question remains: why this fails? It works on Linux, as it is
 seen from bug report it works also on FreeBSD 6.x, why it does not
 work anymore on FreeBSD 7.x? Is it correct that it does not work? I
 have not found anywhere written that O_WRONLY should be specified with
 O_APPEND.
 

Just a thought, but have you figured out what the value of
that OR is? then check the 6.x and 7.x src.

gary


 
 Mitar
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 2.17a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

On Sun, Dec 28, 2008 at 4:58 AM, Gary Kline kl...@thought.org wrote:
 Just a thought, but have you figured out what the value of
 that OR is? then check the 6.x and 7.x src.

You mean O_RDONLY? Is not that 0? So that O_RDONLY | O_APPEND is the
same as O_APPEND? (That is why I am writing about O_APPEND flag and
not O_RDONLY | O_APPEND as that bug report.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mel
On Saturday 27 December 2008 18:16:41 Mitar wrote:
 Hi!

 On Sun, Dec 28, 2008 at 1:17 AM, Mel

 fbsd.questi...@rachie.is-a-geek.net wrote:
 15  fd = open(fname, O_WRONLY|O_APPEND);

 Try only with O_APPEND, without O_WRONLY.

Why would you?
open(2) will succeed but write(2) will fail with EBADF as documented (and I 
verified this behavior). Still no EACCES as you and the bugreporter are 
seeing.

If this is really a bug in FreeBSD I'd expect way more applications to suffer 
issues. There must be something else at play and I certainly don't have an 
explanation why specifying the O_WRONLY flag would cause this bug to 
disappear.

I suspect priv(9) to be responsible for the change in behavior you're seeing, 
however that should return EPERM not EACCES.
-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

On Sun, Dec 28, 2008 at 5:10 AM, Mel
fbsd.questi...@rachie.is-a-geek.net wrote:
 open(2) will succeed but write(2) will fail with EBADF as documented (and I
 verified this behavior). Still no EACCES as you and the bugreporter are
 seeing.

Where is documented that write would fail if file is opened only with
O_APPEND? Just O_APPEND should also open file for writing as appending
is also writing. It cannot be used without write semantics so file
has to be open also for writing.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Gary Kline
On Sun, Dec 28, 2008 at 05:03:59AM +0100, Mitar wrote:
 Hi!
 
 On Sun, Dec 28, 2008 at 4:58 AM, Gary Kline kl...@thought.org wrote:
  Just a thought, but have you figured out what the value of
  that OR is? then check the 6.x and 7.x src.
 
 You mean O_RDONLY? Is not that 0? So that O_RDONLY | O_APPEND is the
 same as O_APPEND? (That is why I am writing about O_APPEND flag and
 not O_RDONLY | O_APPEND as that bug report.
 
 
 Mitar



i WAS in fact, just looking at man open, but not the header.
just check the int values for the two #defines, OR them, then
stare at the 6.x and 7.x code.  more simply, diff the two

this is a bug--thanks for the Clue--but it is fixable.

nutshell, it may be zero: i don't know.

gary

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 2.17a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Jonathan Chen
On Sun, Dec 28, 2008 at 05:46:39AM +0100, Mitar wrote:
 Hi!
 
 On Sun, Dec 28, 2008 at 5:10 AM, Mel
 fbsd.questi...@rachie.is-a-geek.net wrote:
  open(2) will succeed but write(2) will fail with EBADF as documented (and I
  verified this behavior). Still no EACCES as you and the bugreporter are
  seeing.
 
 Where is documented that write would fail if file is opened only with
 O_APPEND? Just O_APPEND should also open file for writing as appending
 is also writing. It cannot be used without write semantics so file
 has to be open also for writing.

If I recall correctly, this behaviour has been standard on UNIX-like
OS's for a *very* long time now. If you are seeing a write allowed
with just O_APPEND on Linux, it would very likely be a Linux only
feature.

Cheers.
-- 
Jonathan Chen j...@chen.org.nz
--
The Internet: an empirical test of the idea that a million monkeys
banging on a million keyboards can produce Shakespeare
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


*.ko.symbols files in /boot/kernel

2008-12-27 Thread Sergey Kovalev

I've decided to upgrade from 6.4-p1 to 7.1-RC2 on my home desktop pc.
Somewhat during this procedure triggered building and installing of 
*.ko.symbols and kernel.symbols files.

Here are my upgrade commands
cd /usr/src
env -i make buildworld
env -i make buildkernel KERNCONF=KOCA
env -i make installkernel KERNCONF=KOCA

After that I get errors because my / patrition is only 128M in size. And 
/boot/kernel gets filled with *.symbols files.

What could trigger their building and installation?

And how I should cleanly rebuild/reinstall kernel in this case without 
rebuilding the world. I know the right path to rebuild everything 
cleanly, but never faced such difficulties.


My /etc/make.conf: http://kovalev.com.ru/make.conf
My kernel config: http://kovalev.com.ru/KOCA

Please CC me cause I'm subscribed to the list.

PS I've mistyped address and first posted to freebsd-us...@freebsd.org. 
Sorry if I posted to the same list twice.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re[2]: can not start SVNserve

2008-12-27 Thread KES
Здравствуйте, Mel.

Вы писали 25 декабря 2008 г., 20:13:32:

M On Tuesday 23 December 2008 13:50:59 KES wrote:
 Здравствуйте, KES.

 Вы писали 21 декабря 2008 г., 13:49:04:

 K Здравствуйте, Mel.

 K Вы писали 21 декабря 2008 г., 13:10:47:

 M On Thursday 18 December 2008 09:03:54 KES wrote:
  Здравствуйте, Mel.
 
  Вы писали 18 декабря 2008 г., 9:05:35:
 
  M On Wednesday 17 December 2008 21:02:07 KES wrote:
   Здравствуйте, Mel.
  
   Вы писали 17 декабря 2008 г., 9:11:19:
  
   M On Sunday 14 December 2008 16:11:17 KES wrote:
Здравствуйте, Polytropon.
   
Вы писали 14 декабря 2008 г., 15:11:35:
   
P On Sun, 14 Dec 2008 12:58:55 +0100 (CET), Wojciech Puchar
   
P woj...@wojtek.tensor.gdynia.pl wrote:
  su: Sorry
 
 
  kes# pw user mod svn -s /bin/bash
  kes# pw user show svn
  svn:*:1005:1005::0:0:SVN user:/nonexistent:/bin/bash
  kes# /usr/local/etc/rc.d/svnserve start
  Starting svnserve.
  su: Sorry

 try to change directory to existent
   
P (1) What's /bin/bash? Check existing shell.
   
P (2) As you said: Check existing directory.
   
P (3) Regarding su, check for wheel group inclusion.
   
home# uname -a
FreeBSD home.kes.net.ua 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue Aug
12 02:11:24 EEST 2008
k...@kes.net.ua:/usr/obj/usr/src/sys/KES_KERN_v7 i386 home# pw
user show svn
svn:*:1003:1002::0:0:SVN user:/nonexistent:/usr/sbin/nologin
   
As you can see on 'home' machine svn user has no valid shell also
it has not valid home directory and it is not included into wheel
group
   
But svnserve is started and works fine. With same settings
svnserve does not work on
kes# uname -a
FreeBSD kes.net.ua 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #: Sun
Nov 23 17:19:12 EET 2008
k...@home.kes.net.ua:/usr/obj/usr/src/sys/KES_KERN_v7 i386
  
   M echo 'rc_debug=YES'/etc/rc.conf
   M /usr/local/etc/rc.d/svnserve start
  
   M Show output from /var/log/messages.
  
   kes# kes# /usr/local/etc/rc.d/svnserve start
   /usr/local/etc/rc.d/svnserve: DEBUG: checkyesno: svnserve_enable is
   set to YES. Starting svnserve.
   /usr/local/etc/rc.d/svnserve: DEBUG: run_rc_command: doit: su -m svn
   -c 'sh -c /usr/local/bin/svnserve -d --listen-port=3690
   --foreground -r /var/db/trunk' su: Sorry
 
  M Does this command work from the command line?
  M If not, does it work if called as su -fm rather then su -m?
  M If that does not work, does the primary group svn is supposed to be
  in exist?
 
 
  kes# su -m svn -c 'sh -c /usr/local/bin/svnserve -d --listen-port=3690
  --foreground -r /var/db/trunk' su: Sorry
  kes# su -fm svn -c 'sh -c /usr/local/bin/svnserve -d
  --listen-port=3690 --foreground -r /var/db/trunk' su: Sorry
  kes# pw group show svn
  svn:*:1005:
  kes# cat /etc/group | grep svn
  svn:*:1005:
  kes# pw user show svn
  svn:*:1005:1005::0:0:SVN user:/nonexistent:/bin/bash
 
  As you see it does not work also with -fm option
 
 
  Also I notice next differences between FreeBDS 7.0 and 7.1 (detail
  below) Notice that on both system account is locked, has no valid shell
  and home directory
  on FreeBSD 7.0 when I try to login with svn user it says: This account
  is currently not available. on FreeBSD 7.1 when I try to login with svn
  user it says: su: Sorry Maybe there is a problem with su on FreeBSD
  7.1?
 
 
 
  home# pw user show svn
  svn:*:1003:1002::0:0:SVN user:/nonexistent:/usr/sbin/nologin
  home# su svn
  This account is currently not available.
 
 
  kes# pw user show svn
  svn:*:1005:1005::0:0:SVN user:/nonexistent:/bin/bash
  kes# su svn
  su: Sorry
  kes# pw user mod svn -s /usr/bin/nologin
  kes# pw user show svn
  svn:*:1005:1005::0:0:SVN user:/nonexistent:/usr/bin/nologin
  kes# su svn
  su: Sorry

 M The problem is elsewhere. Probably in pam(3) on the faulty machine. The
 only M change to su.c from 7.0 to 7.1 is fixing a compiler warning. There
 are 3 M instances where su exits with Sorry. All occasions are logged
 to syslog. M Can you dig those log entries up?

 K Dec 21 13:47:54 kes su: kes to root on /dev/ttyp5
 K Dec 21 13:47:58 kes kes: /r/svnserve: DEBUG: checkyesno: svnserve_enable
 is set to YES. K Dec 21 13:47:58 kes kes: /r/svnserve: DEBUG:
 run_rc_command: doit: K su -m svn -c 'sh -c /usr/local/bin/svnserve -d
 K --listen-port=3690 --foreground -r /var/db/trunk'
 K Dec 21 13:47:58 kes su: pam_acct_mgmt: authentication error

 K Yeah, there is problem with pam. Why pam restrict root to run command
 K under other user?

 Strange, but mysql works... ((

 kes# /r/mysql-server start
 /r/mysql-server: DEBUG: checkyesno: mysql_enable is set to YES.
 /r/mysql-server: DEBUG: pid file (/var/db/mysql/kes.net.ua.pid): not
 readable. /r/mysql-server: DEBUG: run_rc_command: start_precmd:
 mysql_prestart /r/mysql-server: DEBUG: checkyesno: mysql_limits is set to
 NO.
 Starting mysql.
 /r/mysql-server: DEBUG: run_rc_command: doit: su -m mysql -c 'sh -c