Writing to mmaped region cause segfault

2010-11-03 Thread Alexey Suslikov
Hello t...@.

On OpenBSD/amd64, doing something like
char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
MAP_PRIVATE, some.fd, 0);
buf[len] = '\0';
causes segfault on buf[len] = '\0' assignment if len = 16384.

However doing
char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
MAP_PRIVATE, some.fd, 0);
char *nbuf = malloc(len + 1);
memcpy(nbuf, buf, len);
nbuf[len] = '\0';
does not lead to a crash.

Is it expected behavior of mmap (alignment?) or usage of mmap is wrong?

Thanks.

Alexey



Re: Writing to mmaped region cause segfault

2010-11-03 Thread Otto Moerbeek
On Wed, Nov 03, 2010 at 01:18:51PM +0200, Alexey Suslikov wrote:

 Hello t...@.
 
 On OpenBSD/amd64, doing something like
 char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
 MAP_PRIVATE, some.fd, 0);
 buf[len] = '\0';
 causes segfault on buf[len] = '\0' assignment if len = 16384.
 
 However doing
 char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
 MAP_PRIVATE, some.fd, 0);
 char *nbuf = malloc(len + 1);
 memcpy(nbuf, buf, len);
 nbuf[len] = '\0';
 does not lead to a crash.
 
 Is it expected behavior of mmap (alignment?) or usage of mmap is wrong?
 
 Thanks.
 
 Alexey

This (complete!) program does not show the behahaviour. Please post a
complete testcase. Did you include sys/mman.h?

-Otto

#include sys/types.h
#include sys/mman.h

#include err.h
#include fcntl.h
#include stdio.h
#include stdlib.h


int
main()
{
int fd;
char *buf;
size_t len;

fd = open(file, O_RDWR, 0);
if (fd == -1)
err(1, NULL);

len = 16384;
buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE,
fd, (off_t)0);
if (buf == MAP_FAILED)
err(1, NULL);
buf[len] = '\0';
}



Re: Writing to mmaped region cause segfault

2010-11-03 Thread Otto Moerbeek
On Wed, Nov 03, 2010 at 01:12:20PM +0100, Otto Moerbeek wrote:

 On Wed, Nov 03, 2010 at 01:18:51PM +0200, Alexey Suslikov wrote:
 
  Hello t...@.
  
  On OpenBSD/amd64, doing something like
  char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
  MAP_PRIVATE, some.fd, 0);
  buf[len] = '\0';
  causes segfault on buf[len] = '\0' assignment if len = 16384.
  
  However doing
  char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
  MAP_PRIVATE, some.fd, 0);
  char *nbuf = malloc(len + 1);
  memcpy(nbuf, buf, len);
  nbuf[len] = '\0';
  does not lead to a crash.
  
  Is it expected behavior of mmap (alignment?) or usage of mmap is wrong?
  
  Thanks.
  
  Alexey
 
 This (complete!) program does not show the behahaviour. Please post a
 complete testcase. Did you include sys/mman.h?

BTW, accesses beyond the file do cause a segfault, and that is correct.

Note that your firts case accesses buf[16384], while your memcpy does
not access that address.

-Otto

 
 #include sys/types.h
 #include sys/mman.h
 
 #include err.h
 #include fcntl.h
 #include stdio.h
 #include stdlib.h
 
 
 int
 main()
 {
   int fd;
   char *buf;
   size_t len;
 
   fd = open(file, O_RDWR, 0);
   if (fd == -1)
   err(1, NULL);
 
   len = 16384;
   buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE,
   fd, (off_t)0);
   if (buf == MAP_FAILED)
   err(1, NULL);
   buf[len] = '\0';
 }



Small fix for games/cribbage

2010-11-03 Thread David Coppa
Ok?

Index: support.c
===
RCS file: /cvs/src/games/cribbage/support.c,v
retrieving revision 1.11
diff -u -p -r1.11 support.c
--- support.c   27 Oct 2009 23:59:24 -  1.11
+++ support.c   2 Nov 2010 19:31:12 -
@@ -31,6 +31,7 @@
  */
 
 #include curses.h
+#include err.h
 #include string.h
 
 #include deck.h
@@ -107,7 +108,7 @@ cchose(CARD h[], int n, int s)
}
}
if (j  0)
-   errx(cchose internal error %d %d, j, n);
+   errx(1, cchose internal error %d %d, j, n);
return (j);
 }



Re: Writing to mmaped region cause segfault

2010-11-03 Thread Alexey Suslikov
This is somewhat ports related, but I decided to ask here before going
further with diff.

Well, we have Asterisk 1.6.2.14-rc1 going segfault:

#0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
uri=0x4001 Address 0x4001 out of bounds, method=205216842,
params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
contentlength=0x2057b2c84) at manager.c:4005
4005

#0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
uri=0x4001 Address 0x4001 out of bounds, method=205216842,
params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
contentlength=0x2057b2c84) at manager.c:4005
buf = 0x208dd5000 Address 0x208dd5000 out of bounds
l = 16384
s = {session = 0x203382800, f = 0x2036d3440, fd = 245}
session = (struct mansession_session *) 0x203382800
ident = 390437576
blastaway = 0
v = (struct ast_variable *) 0x4000
template = /tmp/ast-http-U9afaz
out = (struct ast_str *) 0x207fd7800
m = {hdrcount = 2, headers = {0x2057b2470 Action: CoreShowChannels,
0x2057b2450 mansession_id: 17459ac8, 0x0 repeats 126 times}}
x = 16385
hdrlen = 0

Relevant lines are:

if (s.f != NULL) {  /* have temporary output */
char *buf;
size_t l;

if ((l = ftell(s.f))) {
if (MAP_FAILED == (buf = mmap(NULL, l + 1,
PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) {
ast_log(LOG_WARNING, mmap failed.
Manager output was not processed\n);
} else {
=4005:buf[l] = '\0';
if (format == FORMAT_XML || format ==
FORMAT_HTML) {
xml_translate(out, buf,
params, format);
} else {
ast_str_append(out, 0, %s, buf);
}
munmap(buf, l + 1);
}
} else if (format == FORMAT_XML || format == FORMAT_HTML) {
xml_translate(out, , params, format);
}
fclose(s.f);
s.f = NULL;
s.fd = -1;
}

So if ftell() returns value of l exactly at the end of file, accessing
l + 1 leads to segfault while mmaping l + 1 is ok, right?

On Wed, Nov 3, 2010 at 14:23, Otto Moerbeek o...@drijf.net wrote:
 On Wed, Nov 03, 2010 at 01:12:20PM +0100, Otto Moerbeek wrote:

 On Wed, Nov 03, 2010 at 01:18:51PM +0200, Alexey Suslikov wrote:

  Hello t...@.
 
  On OpenBSD/amd64, doing something like
  char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
  MAP_PRIVATE, some.fd, 0);
  buf[len] = '\0';
  causes segfault on buf[len] = '\0' assignment if len = 16384.
 
  However doing
  char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
  MAP_PRIVATE, some.fd, 0);
  char *nbuf = malloc(len + 1);
  memcpy(nbuf, buf, len);
  nbuf[len] = '\0';
  does not lead to a crash.
 
  Is it expected behavior of mmap (alignment?) or usage of mmap is wrong?
 
  Thanks.
 
  Alexey

 This (complete!) program does not show the behahaviour. Please post a
 complete testcase. Did you include sys/mman.h?

 BTW, accesses beyond the file do cause a segfault, and that is correct.

 Note that your firts case accesses buf[16384], while your memcpy does
 not access that address.

-Otto


 #include sys/types.h
 #include sys/mman.h

 #include err.h
 #include fcntl.h
 #include stdio.h
 #include stdlib.h


 int
 main()
 {
   int fd;
   char *buf;
   size_t len;

   fd = open(file, O_RDWR, 0);
   if (fd == -1)
   err(1, NULL);

   len = 16384;
   buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE,
   fd, (off_t)0);
   if (buf == MAP_FAILED)
   err(1, NULL);
   buf[len] = '\0';
 }



Re: Writing to mmaped region cause segfault

2010-11-03 Thread Otto Moerbeek
On Wed, Nov 03, 2010 at 02:33:12PM +0200, Alexey Suslikov wrote:

 This is somewhat ports related, but I decided to ask here before going
 further with diff.
 
 Well, we have Asterisk 1.6.2.14-rc1 going segfault:
 
 #0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
 uri=0x4001 Address 0x4001 out of bounds, method=205216842,
 params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
 contentlength=0x2057b2c84) at manager.c:4005
 4005
 
 #0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
 uri=0x4001 Address 0x4001 out of bounds, method=205216842,
 params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
 contentlength=0x2057b2c84) at manager.c:4005
   buf = 0x208dd5000 Address 0x208dd5000 out of bounds
   l = 16384
   s = {session = 0x203382800, f = 0x2036d3440, fd = 245}
   session = (struct mansession_session *) 0x203382800
   ident = 390437576
   blastaway = 0
   v = (struct ast_variable *) 0x4000
   template = /tmp/ast-http-U9afaz
   out = (struct ast_str *) 0x207fd7800
   m = {hdrcount = 2, headers = {0x2057b2470 Action: CoreShowChannels,
 0x2057b2450 mansession_id: 17459ac8, 0x0 repeats 126 times}}
   x = 16385
   hdrlen = 0
 
 Relevant lines are:
 
 if (s.f != NULL) {  /* have temporary output */
 char *buf;
 size_t l;
 
 if ((l = ftell(s.f))) {
 if (MAP_FAILED == (buf = mmap(NULL, l + 1,
 PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) {
 ast_log(LOG_WARNING, mmap failed.
 Manager output was not processed\n);
 } else {
 =4005:buf[l] = '\0';
 if (format == FORMAT_XML || format ==
 FORMAT_HTML) {
 xml_translate(out, buf,
 params, format);
 } else {
 ast_str_append(out, 0, %s, buf);
 }
 munmap(buf, l + 1);
 }
 } else if (format == FORMAT_XML || format == FORMAT_HTML) {
 xml_translate(out, , params, format);
 }
 fclose(s.f);
 s.f = NULL;
 s.fd = -1;
 }
 
 So if ftell() returns value of l exactly at the end of file, accessing
 l + 1 leads to segfault while mmaping l + 1 is ok, right?

Right. And if l is on a page boundary, you have a problem.

-Otto

 
 On Wed, Nov 3, 2010 at 14:23, Otto Moerbeek o...@drijf.net wrote:
  On Wed, Nov 03, 2010 at 01:12:20PM +0100, Otto Moerbeek wrote:
 
  On Wed, Nov 03, 2010 at 01:18:51PM +0200, Alexey Suslikov wrote:
 
   Hello t...@.
  
   On OpenBSD/amd64, doing something like
   char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
   MAP_PRIVATE, some.fd, 0);
   buf[len] = '\0';
   causes segfault on buf[len] = '\0' assignment if len = 16384.
  
   However doing
   char *buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE,
   MAP_PRIVATE, some.fd, 0);
   char *nbuf = malloc(len + 1);
   memcpy(nbuf, buf, len);
   nbuf[len] = '\0';
   does not lead to a crash.
  
   Is it expected behavior of mmap (alignment?) or usage of mmap is wrong?
  
   Thanks.
  
   Alexey
 
  This (complete!) program does not show the behahaviour. Please post a
  complete testcase. Did you include sys/mman.h?
 
  BTW, accesses beyond the file do cause a segfault, and that is correct.
 
  Note that your firts case accesses buf[16384], while your memcpy does
  not access that address.
 
 -Otto
 
 
  #include sys/types.h
  #include sys/mman.h
 
  #include err.h
  #include fcntl.h
  #include stdio.h
  #include stdlib.h
 
 
  int
  main()
  {
int fd;
char *buf;
size_t len;
 
fd = open(file, O_RDWR, 0);
if (fd == -1)
err(1, NULL);
 
len = 16384;
buf = mmap(NULL, len + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE,
fd, (off_t)0);
if (buf == MAP_FAILED)
err(1, NULL);
buf[len] = '\0';
  }



Re: Writing to mmaped region cause segfault

2010-11-03 Thread Ariane van der Steldt
On Wed, Nov 03, 2010 at 02:33:12PM +0200, Alexey Suslikov wrote:
 This is somewhat ports related, but I decided to ask here before going
 further with diff.
 
 Well, we have Asterisk 1.6.2.14-rc1 going segfault:
 
 #0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
 uri=0x4001 Address 0x4001 out of bounds, method=205216842,
 params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
 contentlength=0x2057b2c84) at manager.c:4005
 4005
 
 #0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
 uri=0x4001 Address 0x4001 out of bounds, method=205216842,
 params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
 contentlength=0x2057b2c84) at manager.c:4005
   buf = 0x208dd5000 Address 0x208dd5000 out of bounds
   l = 16384
   s = {session = 0x203382800, f = 0x2036d3440, fd = 245}
   session = (struct mansession_session *) 0x203382800
   ident = 390437576
   blastaway = 0
   v = (struct ast_variable *) 0x4000
   template = /tmp/ast-http-U9afaz
   out = (struct ast_str *) 0x207fd7800
   m = {hdrcount = 2, headers = {0x2057b2470 Action: CoreShowChannels,
 0x2057b2450 mansession_id: 17459ac8, 0x0 repeats 126 times}}
   x = 16385
   hdrlen = 0
 
 Relevant lines are:
 
 if (s.f != NULL) {  /* have temporary output */
 char *buf;
 size_t l;
 
 if ((l = ftell(s.f))) {
 if (MAP_FAILED == (buf = mmap(NULL, l + 1,
 PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) {
 ast_log(LOG_WARNING, mmap failed.
 Manager output was not processed\n);
 } else {
 =4005:buf[l] = '\0';
 if (format == FORMAT_XML || format ==
 FORMAT_HTML) {
 xml_translate(out, buf,
 params, format);
 } else {
 ast_str_append(out, 0, %s, buf);
 }
 munmap(buf, l + 1);
 }
 } else if (format == FORMAT_XML || format == FORMAT_HTML) {
 xml_translate(out, , params, format);
 }
 fclose(s.f);
 s.f = NULL;
 s.fd = -1;
 }
 
 So if ftell() returns value of l exactly at the end of file, accessing
 l + 1 leads to segfault while mmaping l + 1 is ok, right?

Byte l+1 is not present in the file. Reading or writing on that byte is
going to yield undefined behaviour regardless.

Requesting a length larger than the file length is fine. mmap(2) maps
'at most len bytes'.

http://www.opengroup.org/onlinepubs/7990989775/xsh/mmap.html mentions
SIGBUS instead of SIGSEGV for the pages that aren't be mapped.

Ciao,
-- 
Ariane



pool_sethardlimit should not imply pool_sethiwat

2010-11-03 Thread Mike Belopuhov
Hi,

looking into the pool code we realized that pool_sethardlimit
does some extra work that it's not supposed to do.  essentially
pool_sethardlimit is there so that we can set a maximum number
of entries pool_get can give away.  though currently it doesn't
do only that.  it also sets a limit on how many empty pages pool
should keep around available for further allocations.  and that's
precisely what pool_sethiwat is all about.

the problem is that it sets those limits to the same value, which
in case of large pools (as cluster pool) can end up with 3000
pages or more.

there are situations when you need to keep around more pages than
the default (which is 8 btw), but surely this isn't the same as
a possible maximum of entries pool can give away.  these pools
can call pool_sethiwat directly and set appropriate limits
themselves (and they do actually).

ok to commit?

currently there are a bunch of pools that do pool_sethardlimit,
so please take time and verify that pool_sethardlimit usage there
doesn't imply pool_sethiwat (mclpools are taken care of):

./net/pf_ioctl.c:   pool_sethardlimit(pf_pool_limits[PF_LIMIT_STATES].pp,
./net/pf_ioctl.c:   
pool_sethardlimit(pf_pool_limits[i].pp,
./net/pf_norm.c:pool_sethardlimit(pf_frent_pl, PFFRAG_FRENT_HIWAT, 
NULL, 0);
./net/pf_norm.c:pool_sethardlimit(pf_cache_pl, PFFRAG_FRCACHE_HIWAT, 
NULL, 0);
./net/pf_norm.c:pool_sethardlimit(pf_cent_pl, PFFRAG_FRCENT_HIWAT, 
NULL, 0);
./netinet/tcp_subr.c:   pool_sethardlimit(tcpqe_pool, tcp_reass_limit, NULL, 
0);
./netinet/tcp_subr.c:   pool_sethardlimit(sackhl_pool, tcp_sackhole_limit, 
NULL, 0);
./netinet/tcp_usrreq.c: error = pool_sethardlimit(tcpqe_pool, 
nval, NULL, 0);
./netinet/tcp_usrreq.c: error = pool_sethardlimit(sackhl_pool, 
nval, NULL, 0);

Index: kern/subr_pool.c
===
RCS file: /home/cvs/src/sys/kern/subr_pool.c,v
retrieving revision 1.98
diff -u -p -r1.98 subr_pool.c
--- kern/subr_pool.c26 Sep 2010 21:03:57 -  1.98
+++ kern/subr_pool.c3 Nov 2010 14:58:15 -
@@ -993,13 +1026,6 @@ pool_sethardlimit(struct pool *pp, u_int
pp-pr_hardlimit_ratecap.tv_sec = ratecap;
pp-pr_hardlimit_warning_last.tv_sec = 0;
pp-pr_hardlimit_warning_last.tv_usec = 0;
-
-   /*
-* In-line version of pool_sethiwat().
-*/
-   pp-pr_maxpages = (n == 0 || n == UINT_MAX)
-   ? n
-   : roundup(n, pp-pr_itemsperpage) / pp-pr_itemsperpage;
 
 done:
return (error);



Re: Writing to mmaped region cause segfault

2010-11-03 Thread Ted Unangst
On Wed, Nov 3, 2010 at 8:33 AM, Alexey Suslikov
alexey.susli...@gmail.com wrote:
 This is somewhat ports related, but I decided to ask here before going
 further with diff.

 Well, we have Asterisk 1.6.2.14-rc1 going segfault:

 #0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
uri=0x4001 Address 0x4001 out of bounds, method=205216842,
params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
contentlength=0x2057b2c84) at manager.c:4005
 4005

 #0  generic_http_callback (format=FORMAT_XML, remote_address=0x4001,
uri=0x4001 Address 0x4001 out of bounds, method=205216842,
params=0x20eb5bc00, status=0x2057b2c74, title=0x2057b2c78,
contentlength=0x2057b2c84) at manager.c:4005
buf = 0x208dd5000 Address 0x208dd5000 out of bounds
l = 16384
s = {session = 0x203382800, f = 0x2036d3440, fd = 245}
session = (struct mansession_session *) 0x203382800
ident = 390437576
blastaway = 0
v = (struct ast_variable *) 0x4000
template = /tmp/ast-http-U9afaz
out = (struct ast_str *) 0x207fd7800
m = {hdrcount = 2, headers = {0x2057b2470 Action:
CoreShowChannels,
0x2057b2450 mansession_id: 17459ac8, 0x0 repeats 126 times}}
x = 16385
hdrlen = 0

 Relevant lines are:

if (s.f != NULL) {  /* have temporary output */
char *buf;
size_t l;

if ((l = ftell(s.f))) {
if (MAP_FAILED == (buf = mmap(NULL, l + 1,
 PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) {
ast_log(LOG_WARNING, mmap failed.
 Manager output was not processed\n);
} else {
 =4005:buf[l] = '\0';
if (format == FORMAT_XML || format ==
 FORMAT_HTML) {
xml_translate(out, buf,
 params, format);
} else {
ast_str_append(out, 0, %s, buf);
}
munmap(buf, l + 1);
}
} else if (format == FORMAT_XML || format == FORMAT_HTML) {
xml_translate(out, , params, format);
}
fclose(s.f);
s.f = NULL;
s.fd = -1;
}

 So if ftell() returns value of l exactly at the end of file, accessing
 l + 1 leads to segfault while mmaping l + 1 is ok, right?

mmapping l + 1 doesn't really make sense, you can only map the bytes
that are in the file.  the call succeeds, but you aren't going to grow
the file or get more memory.  if you want a null terminated string,
either null terminate the file or copy it to a buffer in memory.



Re: pool_sethardlimit should not imply pool_sethiwat

2010-11-03 Thread Ted Unangst
On Wed, Nov 3, 2010 at 11:22 AM, Mike Belopuhov m...@crypt.org.ru wrote:
 there are situations when you need to keep around more pages than
 the default (which is 8 btw), but surely this isn't the same as
 a possible maximum of entries pool can give away.  these pools
 can call pool_sethiwat directly and set appropriate limits
 themselves (and they do actually).

I think this is fine.  The need for even setting hiwat is not so
important I think with better backend allocators now.



WIP: Support Synaptics touchpad

2010-11-03 Thread Alexandr Shadchin
Hi!

Add support Synaptics touchpad (includes rework pms)

Build:

cd /tmp
ftp http://koba.devio.us/distfiles/synaptics.diff
cd /usr/src/sys
patch -p0 /tmp/synaptics.diff
...
(build and install kernel, reboot)
...
cd /tmp
ftp http://koba.devio.us/distfiles/xf86-input-synaptics.tgz
cd /usr/src
make includes
cd /usr/xenocara/driver
tar zxf /tmp/xf86-input-synaptics.tgz
cd xf86-input-synaptics
env XENOCARA_RERUN_AUTOCONF=Yes make -f Makefile.bsd-wrapper build

xorg.conf:

If only touchpad:

Section ServerLayout
...
InputDevice Mouse0 CorePointer
...
EndSection

# Touchpad
Section InputDevice
Identifier  Mouse0
Driver  synaptics
Option  Protocol wsmouse
Option  Device /dev/wsmouse0
...
EndSection

If touchpad+trackpoint:

Section ServerLayout
...
InputDevice Mouse0 CorePointer
InputDevice Mouse1 SendCoreEvents
...
EndSection

# Touchpad
Section InputDevice
Identifier  Mouse0
Driver  synaptics
Option  Protocol wsmouse
Option  Device /dev/wsmouse0
...
EndSection

# Trackpoint
Section InputDevice
Identifier  Mouse1
Driver  mouse
Option  Protocol wsmouse
Option  Device /dev/wsmouse1
...
EndSection

Test, comment ;-)
Who will test, send your dmesg (sufficient grep pms0)

-- 
Alexandr Shadchin



document ldapd schema files

2010-11-03 Thread Martin Hedenfalk
On Wed, Nov 03, 2010 at 01:19:26PM -0400, Ted Unangst wrote:
 Am I missing something, or is there no documentation for the schema
 files?  man ldapd.conf tells me I can include additional schema files
 via the schema keyword, but nothing tells me what to put in those
 files.

Following diff attempts to documents the schema file syntax.  Only
a brief synopsis of the attribute type and object class syntax is
given, the rest is referred to the RFC.

I couldn't get the long synopsis lines to display as I wanted, so
I'm hoping for some mdoc help :)

-martin


Index: ldapd.conf.5
===
RCS file: /cvs/src/usr.sbin/ldapd/ldapd.conf.5,v
retrieving revision 1.11
diff -u -p -u -r1.11 ldapd.conf.5
--- ldapd.conf.53 Nov 2010 11:21:11 -   1.11
+++ ldapd.conf.53 Nov 2010 19:47:39 -
@@ -132,6 +132,9 @@ Password for the root user.
 Specified either in plain text, or in hashed format.
 .It schema Ar filename
 Add schema definitions from the specified file.
+For a description of the schema file syntax see
+.Sx SCHEMA
+below.
 .El
 .Sh NAMESPACES
 A namespace is a subtree of the global X.500 DIT (Directory Information Tree),
@@ -250,16 +253,79 @@ Typically used to allow users to modify 
 Enable compression of entries and optionally specify compression level (0 - 9).
 By default, no compression is used.
 .El
+.Sh SCHEMA
+Schema files define the structure and format of entries in the directory tree.
+There are three types of definitions in a schema file:
+.Bl -tag -width Ds
+.It attributetype
+\*(lp
+.Ar oid
+.Op NAME name
+.Op DESC description
+.Op OBSOLETE
+.Op SUP oid
+.Op EQUALITY oid
+.Op ORDERING oid
+.Op SUBSTR oid
+.Op SYNTAX oid
+.Op SINGLE-VALUE
+.Op COLLECTIVE
+.Op NO-USER-MODIFICATION
+.Op USAGE Brq userApplications | directoryOperation | distributedOperation | 
dSAOperation
+\*(rp
+.Pp
+An attribute type definition specifies the syntax of attribute values, whether
+it allows multiple values and how it can be compared in search requests.
+For a complete description of attribute type defitions, see section
+4.1.2 in RFC 4712.
+.It objectclass
+\*(lp
+.Ar oid
+.Op NAME name
+.Op DESC description
+.Op OBSOLETE
+.Op SUP oids
+.Op Brq ABSTRACT | STRUCTURAL | AUXILIARY
+.Op MUST oids
+.Op MAY oids
+\*(rp
+.Pp
+An object class definition specifies which attributes are required
+and which are allowed.
+For a complete description of object class definitions, see section
+4.1.1 in RFC 4712.
+.It objectidentifier Ar symbolic-name Ar OID
+Defines a symbolic name for the object identifier.
+A symbolic name can be used in place of a numeric OID in definitions
+of attribute types, object classes and other symbolic OIDs.
+A descendant OID can be defined in terms of another symbolic OID by appending
+a numeric OID after a colon, for example:
+.Bd -literal -offset indent
+objectidentifier MyOidRoot 1.2.3.4
+objectidentifier MyOidAttributes MyOidRoot:5.6
+objectidentifier MyOidObjects MyOidRoot:7
+.Ed
+.Pp
+This would define MyOidAttributes as a symbolic name for the OID
+1.2.3.4.5.6, and MyOidObjects for 1.2.3.4.7.
+.El
 .Sh FILES
 .Bl -tag -width /etc/ldap/ldapd.confXXX -compact
 .It Pa /etc/ldapd.conf
 Default
 .Xr ldapd 8
 configuration file.
+.It Pa /etc/ldap/*.schema
+Default schema definition files.
 .El
 .Sh SEE ALSO
 .Xr ldapctl 8 ,
 .Xr ldapd 8
+.Rs
+.%R RFC 4512
+.%T Lightweight Directory Access Protocol (LDAP): Directory Information Models
+.%D June 2006
+.Re
 .Sh HISTORY
 The
 .Nm



Meet Phil the Pharisee

2010-11-03 Thread Godthoughts Wired
GodThoughtsWired!Wednesday, November 3, 2010
An Inspiration for Today...A Resource for a Lifetime!


meet phil the pharisee

To the weak I became weak,
that I might win the weak;
I have become all things to all men,
so that I may by all means save some.
1 Corinthians 9:22


Yesterday's GT was entitled, I'm a Giants Fan...But a Jesus Fanatic!  The
point of the message was that, while I enjoy baseball, on a scale of 1-10, in
terms of what's truly important in my life, the Giants and the World Series
aren't even on the scale (see GTWired!, November 2, 2010).

And, as I'm apt to do, I provided a visual illustration from the pulpit to
contrast that which ultimately means nothing (the Giants winning the World
Series), and that which means everything (my relationship with Jesus).

Like the Apostle Paul before me (Olympic games, boxing, running, see above
context 1 Corinthians 9:22-27; see also, 2 Timothy 2:5), I've found sports
llustrations to be powerful teaching tools.  Having said that, I'm sad to
report that phariseeism* is still alive and well in the body of Christ.

Please note the following response from one of our GT subscribers:


You made a poor choice to showboat in the pulpit. On the face of it, the
ministry to which you are called would seem to preclude this...guess
not...Your obvious affection for the Giants should not have intruded in the
pulpit ...Holding on to the world with one hand
and on to the things of God with the other
 is tough. My prayers are with you
as you agonize over these choices.
-Phil the Pharisee*
(name changed to protect the guilty)
Very sadly, I'm reminded of Matthew 11:19,
The Son of Man came eating and drinking,
and they say, 'Behold, a gluttonous man
and a drunkard, a friend
of tax collectors and sinners!'
Yet wisdom is vindicated by her deeds.
Wisdom is vindicated by her deeds.

Indeed!

FOR FURTHER STUDY:
*Pharisee:  religious, judgemental, hypocritical.
  Phariseeism:  see Matthew 23:1-36.
WANT TO KNOW MORE ABOUT THE AUTHOR?  Click here.
WANT TO KNOW MORE ABOUT THE GODTHOUGHTS MINISTRY?  Click here.


Unsubscribe