Discover the HEC Executive MBA in Doha

2010-11-30 Thread HEC Paris Executive Education
DEFINE new perspectives. 

Discover the HEC Executive MBA, now available in Doha 

- 6 Majors to choose from 
- 5 International learning locations 
- 1 Degree recognized worldwide 

>> More information: 
 http://www.restworx.com/page,7803,17484474,101,3426,11240,xrheww8m.html 

 
HEC PARIS 
Ranked # 1 European Business School by the Financial Times since 2006 
Ranked # 2 Worldwide in Executive Education by the Financial Times in 2010 

-- 
To modify your profile or unsubscribe from the Vertical-Mail list, 
click here 
http://www.vminfos.com/opposition/index3_en.php4?dest=HEC&email=t...@openbsd.org&member=&contact_id=17484474&base_id=101&campaign_id=3426&sending_id=11240
 

Vertical-Mail. - All rights reserved)



Re: more hotplug events

2010-11-30 Thread Marco Peereboom
yes please.  I see all kinds of overruns when resuming currently.

On Tue, Nov 30, 2010 at 07:37:06PM -0500, Ted Unangst wrote:
> there are a lot of usb devices that attach more than 16 things at once, 
> notably the "endless stream of nonsense uhid" type gadgetry.  increase the 
> limit.
> 
> this will use more kernel memory of course (only a tiny bit really, but 
> whatever) so it's allocated at first open.  if you don't use hotplug, you 
> don't waste memory on it.  we could in theory make the buffer quite a bit 
> larger even now.
> 
> Index: hotplug.c
> ===
> RCS file: /home/tedu/cvs/src/sys/dev/hotplug.c,v
> retrieving revision 1.9
> diff -u -r1.9 hotplug.c
> --- hotplug.c 9 Nov 2009 17:53:39 -   1.9
> +++ hotplug.c 30 Nov 2010 21:44:43 -
> @@ -26,13 +26,14 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> -#define HOTPLUG_MAXEVENTS16
> +#define HOTPLUG_MAXEVENTS64
>  
>  static int opened;
> -static struct hotplug_event evqueue[HOTPLUG_MAXEVENTS];
> +static struct hotplug_event *evqueue;
>  static int evqueue_head, evqueue_tail, evqueue_count;
>  static struct selinfo hotplug_sel;
>  
> @@ -88,6 +89,8 @@
>   printf("hotplug: event lost, queue full\n");
>   return (1);
>   }
> + if (!evqueue)
> + return (1);
>  
>   evqueue[evqueue_head] = *he;
>   evqueue_head = EVQUEUE_NEXT(evqueue_head);
> @@ -119,12 +122,22 @@
>  int
>  hotplugopen(dev_t dev, int flag, int mode, struct proc *p)
>  {
> + struct hotplug_event *q;
> +
>   if (minor(dev) != 0)
>   return (ENXIO);
>   if ((flag & FWRITE))
>   return (EPERM);
>   if (opened)
>   return (EBUSY);
> + if (!evqueue) {
> + q = malloc(sizeof(*q) * HOTPLUG_MAXEVENTS, M_DEVBUF, M_WAITOK);
> + if (opened) {
> + free(q, M_DEVBUF);
> + return (EBUSY);
> + }
> + evqueue = q;
> + }
>   opened = 1;
>   return (0);
>  }
> @@ -155,7 +168,7 @@
>   if (flags & IO_NDELAY)
>   return (EAGAIN);
>  
> - error = tsleep(evqueue, PRIBIO | PCATCH, "htplev", 0);
> + error = tsleep(&evqueue, PRIBIO | PCATCH, "htplev", 0);
>   if (error)
>   return (error);
>   goto again;



Re: allow bioctl to read passphrase from stdin

2010-11-30 Thread Marco Peereboom
I changed my mind.  I did talk with jsing and deraadt about the bioctl
follow on but haven't gotten to it yet.

On Tue, Nov 30, 2010 at 11:20:53AM -0500, Ted Unangst wrote:
> err, the last time this came up you said you would do it right... :)
> 
> http://marc.info/?l=openbsd-misc&m=125613898224309&w=2
> 
> On Tue, Nov 30, 2010 at 5:16 AM, Marco Peereboom  wrote:
> > I like this.
> >
> > On Mon, Nov 29, 2010 at 02:22:35PM -0800, Chris Kuethe wrote:
> >> Currently bioctl invokes readpassphrase(3) with RPP_REQUIRE_TTY, which
> >> means that there must be a controlling tty to read the password from.
> >> This diff adds an option (-s) to force bioctl to read the passphrase
> >> from stdin. Without this option existing behavior is maintained.
> >>
> >> Index: bioctl.8
> >> ===
> >> RCS file: /cvs/src/sbin/bioctl/bioctl.8,v
> >> retrieving revision 1.82
> >> diff -u -p -r1.82 bioctl.8
> >> --- bioctl.8  20 Nov 2010 17:46:24 -  1.82
> >> +++ bioctl.8  29 Nov 2010 22:17:03 -
> >> @@ -43,7 +43,7 @@
> >>  .Pp
> >>  .Nm bioctl
> >>  .Bk -words
> >> -.Op Fl dhiPqv
> >> +.Op Fl dhiPqsv
> >>  .Op Fl C Ar flag[,flag,...]
> >>  .Op Fl c Ar raidlevel
> >>  .Op Fl k Ar keydisk
> >> @@ -235,6 +235,11 @@ the PBKDF2 algorithm used to convert a p
> >>  Higher iteration counts take more time, but offer more resistance to key
> >>  guessing attacks.
> >>  The minimum is 1000 rounds and the default is 8192.
> >> +.It Fl s
> >> +Read the passphrase for the selected crypto volume from
> >> +.Pa /dev/stdin
> >> +rather than
> >> +.Pa /dev/tty .
> >>  .El
> >>  .Sh EXAMPLES
> >>  The following command, executed from the command line, would configure
> >> Index: bioctl.c
> >> ===
> >> RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
> >> retrieving revision 1.97
> >> diff -u -p -r1.97 bioctl.c
> >> --- bioctl.c  10 Jul 2010 02:56:16 -  1.97
> >> +++ bioctl.c  29 Nov 2010 22:17:03 -
> >> @@ -86,6 +86,7 @@ int rflag = 8192;
> >>  char *password;
> >>
> >>  struct bio_locatebl;
> >> +int rpp_flag = RPP_REQUIRE_TTY;
> >>
> >>  int
> >>  main(int argc, char *argv[])
> >> @@ -106,7 +107,7 @@ main(int argc, char *argv[])
> >>   if (argc < 2)
> >>   usage();
> >>
> >> - while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:vu:")) !=
> >> + while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:svu:")) !=
> >>   -1) {
> >>   switch (ch) {
> >>   case 'a': /* alarm */
> >> @@ -174,6 +175,9 @@ main(int argc, char *argv[])
> >>   ss_func = BIOC_SSREBUILD;
> >>   al_arg = optarg;
> >>   break;
> >> + case 's':
> >> + rpp_flag = RPP_STDIN;
> >> + break;
> >>   case 'v':
> >>   verbose = 1;
> >>   break;
> >> @@ -252,12 +256,12 @@ usage(void)
> >>   "[-R device | channel:target[.lun]\n"
> >>   "\t[-u channel:target[.lun]] "
> >>   "device\n"
> >> -"   %s [-dhiPqv] "
> >> -"[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
> >> -"\t[-l special[,special,...]] [-p passfile]\n"
> >> -"\t[-R device | channel:target[.lun] [-r rounds] "
> >> + "   %s [-dhiPqsv] "
> >> + "[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
> >> + "\t[-l special[,special,...]] [-p passfile]\n"
> >> + "\t[-R device | channel:target[.lun] [-r rounds] "
> >>   "device\n", __progname, __progname);
> >> -
> >> +
> >>   exit(1);
> >>  }
> >>
> >> @@ -1070,14 +1074,14 @@ derive_key_pkcs(int rounds, u_int8_t *ke
> >>   fclose(f);
> >>   } else {
> >>   if (readpassphrase(prompt, passphrase, sizeof(passphrase),
> >> - RPP_REQUIRE_TTY) == NULL)
> >> + rpp_flag) == NULL)
> >>   errx(1, "unable to read passphrase");
> >>   }
> >>
> >>   if (verify) {
> >>   /* request user to re-type it */
> >>   if (readpassphrase("Re-type passphrase: ", verifybuf,
> >> - sizeof(verifybuf), RPP_REQUIRE_TTY) == NULL) {
> >> + sizeof(verifybuf), rpp_flag) == NULL) {
> >>   memset(passphrase, 0, sizeof(passphrase));
> >>   errx(1, "unable to read passphrase");
> >>   }
> >>
> >> --
> >> GDB has a 'break' feature; why doesn't it have 'fix' too?



Inserisci o ricerca immobile

2010-11-30 Thread Annunci immobili
Clicca qui per inserire o cercare annunci

Portale interamente gratuito (sia per l'agenzia immobiliare che per il
privato) che consente di inserire annunci immobiliari riguardanti
immobili in vendita o in affitto. Le persone interessate all'acquisto o
alla locazione di una casa (o di un appartamento, un ufficio, un garage,
di una casa vacanza o di tutte le altre tipologie) possono agevolmente
ricercare fra gli annunci inseriti quello che fa al caso loro.



more hotplug events

2010-11-30 Thread Ted Unangst
there are a lot of usb devices that attach more than 16 things at once, 
notably the "endless stream of nonsense uhid" type gadgetry.  increase the 
limit.

this will use more kernel memory of course (only a tiny bit really, but 
whatever) so it's allocated at first open.  if you don't use hotplug, you 
don't waste memory on it.  we could in theory make the buffer quite a bit 
larger even now.

Index: hotplug.c
===
RCS file: /home/tedu/cvs/src/sys/dev/hotplug.c,v
retrieving revision 1.9
diff -u -r1.9 hotplug.c
--- hotplug.c   9 Nov 2009 17:53:39 -   1.9
+++ hotplug.c   30 Nov 2010 21:44:43 -
@@ -26,13 +26,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-#define HOTPLUG_MAXEVENTS  16
+#define HOTPLUG_MAXEVENTS  64
 
 static int opened;
-static struct hotplug_event evqueue[HOTPLUG_MAXEVENTS];
+static struct hotplug_event *evqueue;
 static int evqueue_head, evqueue_tail, evqueue_count;
 static struct selinfo hotplug_sel;
 
@@ -88,6 +89,8 @@
printf("hotplug: event lost, queue full\n");
return (1);
}
+   if (!evqueue)
+   return (1);
 
evqueue[evqueue_head] = *he;
evqueue_head = EVQUEUE_NEXT(evqueue_head);
@@ -119,12 +122,22 @@
 int
 hotplugopen(dev_t dev, int flag, int mode, struct proc *p)
 {
+   struct hotplug_event *q;
+
if (minor(dev) != 0)
return (ENXIO);
if ((flag & FWRITE))
return (EPERM);
if (opened)
return (EBUSY);
+   if (!evqueue) {
+   q = malloc(sizeof(*q) * HOTPLUG_MAXEVENTS, M_DEVBUF, M_WAITOK);
+   if (opened) {
+   free(q, M_DEVBUF);
+   return (EBUSY);
+   }
+   evqueue = q;
+   }
opened = 1;
return (0);
 }
@@ -155,7 +168,7 @@
if (flags & IO_NDELAY)
return (EAGAIN);
 
-   error = tsleep(evqueue, PRIBIO | PCATCH, "htplev", 0);
+   error = tsleep(&evqueue, PRIBIO | PCATCH, "htplev", 0);
if (error)
return (error);
goto again;



Re: small comment typo in lib/libc/stdlib/bsearch.c

2010-11-30 Thread Jason McIntyre
On Sat, Nov 27, 2010 at 03:18:41PM +0001, Jason McIntyre wrote:
> On Sat, Nov 27, 2010 at 12:04:02PM -0300, Carlos Alberto Pereira Gomes wrote:
> > 
> > Hi Jason,
> > 
> > 
> > I am afraid that, concerning the bsearch.c comment, "involes" was meant
> > "involves" because I think the phrase "moving right again invokes
> > halving lim" does not make sense.
> >  
> 
> yeah. i meant rather to change the other two to "invokes". i agree that
> the bsearch one was meant to be "involves".
> 
> anyway, let's see if oga can fix those comments for us. oga, please fix
> the bsearch one too if you do ;)
> 
> jmc

this never got followed up on, so i fixed the original complaint, and
hereby leave the rest to interested parties.

jmc



Re: allow bioctl to read passphrase from stdin

2010-11-30 Thread Chris Kuethe
On Tue, Nov 30, 2010 at 12:51 AM, Joachim Schipper
 wrote:
> In short, what's the use?

Network unlocks. I don't want to have to wander over to my colo
facility after every reboot, and plug in a disk every time, and I also
don't want to have to log in and run bioctl by hand for every volume.



-- 
GDB has a 'break' feature; why doesn't it have 'fix' too?



Re: update pms driver

2010-11-30 Thread Alexandr Shadchin
On Mon, Nov 29, 2010 at 10:08:22PM +, Nicholas Marriott wrote:
> 
> Well, I don't use it so I don't have strong feelings about it, but it
> does work for PS/2 mice and it seems that it would be useful for anyone
> using wsmoused (although there probably aren't many people).
> 
> Would it be so hard to leave it, and if it is really not needed remove
> it entirely as a separate change?
> 
> Otherwise aside from the char -> signed char change I mentioned the diff
> is fine with me.
> 

1) fix char -> signed char
2) Returned WSMOUSEIO_SRES

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.14
diff -u -p -r1.14 pms.c
--- pms.c   15 Nov 2010 20:25:31 -  1.14
+++ pms.c   30 Nov 2010 16:26:20 -
@@ -40,6 +40,20 @@
 
 #define DEVNAME(sc)((sc)->sc_dev.dv_xname)
 
+struct pms_softc;
+
+struct pms_protocol {
+   int type;
+#define PMS_STANDARD   0
+#define PMS_INTELLI1
+   int packetsize;
+   int (*enable)(struct pms_softc *);
+   int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
+   int (*sync)(struct pms_softc *, int);
+   void (*proc)(struct pms_softc *);
+   void (*disable)(struct pms_softc *);
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
@@ -52,14 +66,38 @@ struct pms_softc {  /* driver status inf
 #define PMS_STATE_SUSPENDED2
 
int poll;
-   int intelli;
int inputstate;
-   u_int buttons, oldbuttons;  /* mouse button status */
-   signed char dx, dy;
+
+   struct pms_protocol protocol;
+
+   unsigned char packet[8];
 
struct device *sc_wsmousedev;
 };
 
+#define PMS_BUTTON1DOWN0x0001  /* left */
+#define PMS_BUTTON2DOWN0x0002  /* middle */
+#define PMS_BUTTON3DOWN0x0004  /* right */
+
+static const u_int butmap[8] = {
+   0,
+   PMS_BUTTON1DOWN,
+   PMS_BUTTON3DOWN,
+   PMS_BUTTON1DOWN | PMS_BUTTON3DOWN,
+   PMS_BUTTON2DOWN,
+   PMS_BUTTON1DOWN | PMS_BUTTON2DOWN,
+   PMS_BUTTON2DOWN | PMS_BUTTON3DOWN,
+   PMS_BUTTON1DOWN | PMS_BUTTON2DOWN | PMS_BUTTON3DOWN
+};
+
+/* PS/2 mouse data packet */
+#define PMS_PS2_BUTTONSMASK0x07
+#define PMS_PS2_BUTTON10x01/* left */
+#define PMS_PS2_BUTTON20x04/* middle */
+#define PMS_PS2_BUTTON30x02/* right */
+#define PMS_PS2_XNEG   0x10
+#define PMS_PS2_YNEG   0x20
+
 intpmsprobe(struct device *, void *, void *);
 void   pmsattach(struct device *, struct device *, void *);
 intpmsactivate(struct device *, int);
@@ -81,7 +119,11 @@ int pms_reset(struct pms_softc *);
 intpms_dev_enable(struct pms_softc *);
 intpms_dev_disable(struct pms_softc *);
 
-intpms_setintellimode(struct pms_softc *sc);
+intpms_enable_intelli(struct pms_softc *);
+
+intpms_ioctl_mouse(struct pms_softc *, u_long, caddr_t, int, struct proc 
*);
+intpms_sync_mouse(struct pms_softc *, int);
+void   pms_proc_mouse(struct pms_softc *);
 
 struct cfattach pms_ca = {
sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
@@ -98,6 +140,27 @@ const struct wsmouse_accessops pms_acces
pms_disable,
 };
 
+const struct pms_protocol pms_mouse[] = {
+   /* Generic PS/2 mouse */
+   {
+   PMS_STANDARD, 3,
+   NULL,
+   pms_ioctl_mouse,
+   pms_sync_mouse,
+   pms_proc_mouse,
+   NULL
+   },
+   /* Microsoft IntelliMouse */
+   {
+   PMS_INTELLI, 4,
+   pms_enable_intelli,
+   pms_ioctl_mouse,
+   pms_sync_mouse,
+   pms_proc_mouse,
+   NULL
+   }
+};
+
 int
 pms_cmd(struct pms_softc *sc, u_char *cmd, int len, u_char *resp, int resplen)
 {
@@ -208,7 +271,7 @@ pms_dev_disable(struct pms_softc *sc)
 }
 
 int
-pms_setintellimode(struct pms_softc *sc)
+pms_enable_intelli(struct pms_softc *sc)
 {
static const int rates[] = {200, 100, 80};
u_char resp;
@@ -224,6 +287,78 @@ pms_setintellimode(struct pms_softc *sc)
 }
 
 int
+pms_ioctl_mouse(struct pms_softc *sc, u_long cmd, caddr_t data, int flag,
+struct proc *p)
+{
+   int i;
+
+   switch (cmd) {
+   case WSMOUSEIO_GTYPE:
+   *(u_int *)data = WSMOUSE_TYPE_PS2;
+   break;
+   case WSMOUSEIO_SRES:
+   i = ((int) *(u_int *)data - 12) / 25;
+   /* valid values are {0,1,2,3} */
+   if (i < 0)
+   i = 0;
+   if (i > 3)
+   i = 3;
+
+   if (pms_set_resolution(sc, i))
+   printf("%s: SET_RES command error\n", DEVNAME(sc));
+   break;
+   default:
+   return (-1);
+   }
+   return (0);
+}
+
+int
+pms_s

Re: allow bioctl to read passphrase from stdin

2010-11-30 Thread Ted Unangst
err, the last time this came up you said you would do it right... :)

http://marc.info/?l=openbsd-misc&m=125613898224309&w=2

On Tue, Nov 30, 2010 at 5:16 AM, Marco Peereboom  wrote:
> I like this.
>
> On Mon, Nov 29, 2010 at 02:22:35PM -0800, Chris Kuethe wrote:
>> Currently bioctl invokes readpassphrase(3) with RPP_REQUIRE_TTY, which
>> means that there must be a controlling tty to read the password from.
>> This diff adds an option (-s) to force bioctl to read the passphrase
>> from stdin. Without this option existing behavior is maintained.
>>
>> Index: bioctl.8
>> ===
>> RCS file: /cvs/src/sbin/bioctl/bioctl.8,v
>> retrieving revision 1.82
>> diff -u -p -r1.82 bioctl.8
>> --- bioctl.8  20 Nov 2010 17:46:24 -  1.82
>> +++ bioctl.8  29 Nov 2010 22:17:03 -
>> @@ -43,7 +43,7 @@
>>  .Pp
>>  .Nm bioctl
>>  .Bk -words
>> -.Op Fl dhiPqv
>> +.Op Fl dhiPqsv
>>  .Op Fl C Ar flag[,flag,...]
>>  .Op Fl c Ar raidlevel
>>  .Op Fl k Ar keydisk
>> @@ -235,6 +235,11 @@ the PBKDF2 algorithm used to convert a p
>>  Higher iteration counts take more time, but offer more resistance to key
>>  guessing attacks.
>>  The minimum is 1000 rounds and the default is 8192.
>> +.It Fl s
>> +Read the passphrase for the selected crypto volume from
>> +.Pa /dev/stdin
>> +rather than
>> +.Pa /dev/tty .
>>  .El
>>  .Sh EXAMPLES
>>  The following command, executed from the command line, would configure
>> Index: bioctl.c
>> ===
>> RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
>> retrieving revision 1.97
>> diff -u -p -r1.97 bioctl.c
>> --- bioctl.c  10 Jul 2010 02:56:16 -  1.97
>> +++ bioctl.c  29 Nov 2010 22:17:03 -
>> @@ -86,6 +86,7 @@ int rflag = 8192;
>>  char *password;
>>
>>  struct bio_locatebl;
>> +int rpp_flag = RPP_REQUIRE_TTY;
>>
>>  int
>>  main(int argc, char *argv[])
>> @@ -106,7 +107,7 @@ main(int argc, char *argv[])
>>   if (argc < 2)
>>   usage();
>>
>> - while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:vu:")) !=
>> + while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:svu:")) !=
>>   -1) {
>>   switch (ch) {
>>   case 'a': /* alarm */
>> @@ -174,6 +175,9 @@ main(int argc, char *argv[])
>>   ss_func = BIOC_SSREBUILD;
>>   al_arg = optarg;
>>   break;
>> + case 's':
>> + rpp_flag = RPP_STDIN;
>> + break;
>>   case 'v':
>>   verbose = 1;
>>   break;
>> @@ -252,12 +256,12 @@ usage(void)
>>   "[-R device | channel:target[.lun]\n"
>>   "\t[-u channel:target[.lun]] "
>>   "device\n"
>> -"   %s [-dhiPqv] "
>> -"[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
>> -"\t[-l special[,special,...]] [-p passfile]\n"
>> -"\t[-R device | channel:target[.lun] [-r rounds] "
>> + "   %s [-dhiPqsv] "
>> + "[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
>> + "\t[-l special[,special,...]] [-p passfile]\n"
>> + "\t[-R device | channel:target[.lun] [-r rounds] "
>>   "device\n", __progname, __progname);
>> -
>> +
>>   exit(1);
>>  }
>>
>> @@ -1070,14 +1074,14 @@ derive_key_pkcs(int rounds, u_int8_t *ke
>>   fclose(f);
>>   } else {
>>   if (readpassphrase(prompt, passphrase, sizeof(passphrase),
>> - RPP_REQUIRE_TTY) == NULL)
>> + rpp_flag) == NULL)
>>   errx(1, "unable to read passphrase");
>>   }
>>
>>   if (verify) {
>>   /* request user to re-type it */
>>   if (readpassphrase("Re-type passphrase: ", verifybuf,
>> - sizeof(verifybuf), RPP_REQUIRE_TTY) == NULL) {
>> + sizeof(verifybuf), rpp_flag) == NULL) {
>>   memset(passphrase, 0, sizeof(passphrase));
>>   errx(1, "unable to read passphrase");
>>   }
>>
>> --
>> GDB has a 'break' feature; why doesn't it have 'fix' too?



Re: update pms driver

2010-11-30 Thread Kevin Chadwick
On Mon, 29 Nov 2010 22:08:22 +
Nicholas Marriott  wrote:

> Well, I don't use it so I don't have strong feelings about it, but it
> does work for PS/2 mice and it seems that it would be useful for anyone
> using wsmoused (although there probably aren't many people).

I use xset m, that isn't affected is it? and so is an alternative,
though maybe it could affect someones current setups?



Re: allow bioctl to read passphrase from stdin

2010-11-30 Thread Marco Peereboom
I like this.

On Mon, Nov 29, 2010 at 02:22:35PM -0800, Chris Kuethe wrote:
> Currently bioctl invokes readpassphrase(3) with RPP_REQUIRE_TTY, which
> means that there must be a controlling tty to read the password from.
> This diff adds an option (-s) to force bioctl to read the passphrase
> from stdin. Without this option existing behavior is maintained.
> 
> Index: bioctl.8
> ===
> RCS file: /cvs/src/sbin/bioctl/bioctl.8,v
> retrieving revision 1.82
> diff -u -p -r1.82 bioctl.8
> --- bioctl.8  20 Nov 2010 17:46:24 -  1.82
> +++ bioctl.8  29 Nov 2010 22:17:03 -
> @@ -43,7 +43,7 @@
>  .Pp
>  .Nm bioctl
>  .Bk -words
> -.Op Fl dhiPqv
> +.Op Fl dhiPqsv
>  .Op Fl C Ar flag[,flag,...]
>  .Op Fl c Ar raidlevel
>  .Op Fl k Ar keydisk
> @@ -235,6 +235,11 @@ the PBKDF2 algorithm used to convert a p
>  Higher iteration counts take more time, but offer more resistance to key
>  guessing attacks.
>  The minimum is 1000 rounds and the default is 8192.
> +.It Fl s
> +Read the passphrase for the selected crypto volume from
> +.Pa /dev/stdin
> +rather than
> +.Pa /dev/tty .
>  .El
>  .Sh EXAMPLES
>  The following command, executed from the command line, would configure
> Index: bioctl.c
> ===
> RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
> retrieving revision 1.97
> diff -u -p -r1.97 bioctl.c
> --- bioctl.c  10 Jul 2010 02:56:16 -  1.97
> +++ bioctl.c  29 Nov 2010 22:17:03 -
> @@ -86,6 +86,7 @@ int rflag = 8192;
>  char *password;
> 
>  struct bio_locatebl;
> +int rpp_flag = RPP_REQUIRE_TTY;
> 
>  int
>  main(int argc, char *argv[])
> @@ -106,7 +107,7 @@ main(int argc, char *argv[])
>   if (argc < 2)
>   usage();
> 
> - while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:vu:")) !=
> + while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:svu:")) !=
>   -1) {
>   switch (ch) {
>   case 'a': /* alarm */
> @@ -174,6 +175,9 @@ main(int argc, char *argv[])
>   ss_func = BIOC_SSREBUILD;
>   al_arg = optarg;
>   break;
> + case 's':
> + rpp_flag = RPP_STDIN;
> + break;
>   case 'v':
>   verbose = 1;
>   break;
> @@ -252,12 +256,12 @@ usage(void)
>   "[-R device | channel:target[.lun]\n"
>   "\t[-u channel:target[.lun]] "
>   "device\n"
> -"   %s [-dhiPqv] "
> -"[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
> -"\t[-l special[,special,...]] [-p passfile]\n"
> -"\t[-R device | channel:target[.lun] [-r rounds] "
> + "   %s [-dhiPqsv] "
> + "[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
> + "\t[-l special[,special,...]] [-p passfile]\n"
> + "\t[-R device | channel:target[.lun] [-r rounds] "
>   "device\n", __progname, __progname);
> - 
> +
>   exit(1);
>  }
> 
> @@ -1070,14 +1074,14 @@ derive_key_pkcs(int rounds, u_int8_t *ke
>   fclose(f);
>   } else {
>   if (readpassphrase(prompt, passphrase, sizeof(passphrase),
> - RPP_REQUIRE_TTY) == NULL)
> + rpp_flag) == NULL)
>   errx(1, "unable to read passphrase");
>   }
> 
>   if (verify) {
>   /* request user to re-type it */
>   if (readpassphrase("Re-type passphrase: ", verifybuf,
> - sizeof(verifybuf), RPP_REQUIRE_TTY) == NULL) {
> + sizeof(verifybuf), rpp_flag) == NULL) {
>   memset(passphrase, 0, sizeof(passphrase));
>   errx(1, "unable to read passphrase");
>   }
> 
> -- 
> GDB has a 'break' feature; why doesn't it have 'fix' too?



Re: allow bioctl to read passphrase from stdin

2010-11-30 Thread Joachim Schipper
On Mon, Nov 29, 2010 at 02:22:35PM -0800, Chris Kuethe wrote:
> Currently bioctl invokes readpassphrase(3) with RPP_REQUIRE_TTY, which
> means that there must be a controlling tty to read the password from.
> This diff adds an option (-s) to force bioctl to read the passphrase
> from stdin. Without this option existing behavior is maintained.

As I recall, last time someone wanted such functionality (perhaps for
vnconfig?), the response was "this makes doing stupid things too easy,
and you should use -k if you want to mount without typing a passphrase".
(Presumably because a keydisk has better entropy than a passphrase.)

In short, what's the use?

Joachim

> Index: bioctl.8
> ===
> RCS file: /cvs/src/sbin/bioctl/bioctl.8,v
> retrieving revision 1.82
> diff -u -p -r1.82 bioctl.8
> --- bioctl.8  20 Nov 2010 17:46:24 -  1.82
> +++ bioctl.8  29 Nov 2010 22:17:03 -
> @@ -43,7 +43,7 @@
>  .Pp
>  .Nm bioctl
>  .Bk -words
> -.Op Fl dhiPqv
> +.Op Fl dhiPqsv
>  .Op Fl C Ar flag[,flag,...]
>  .Op Fl c Ar raidlevel
>  .Op Fl k Ar keydisk
> @@ -235,6 +235,11 @@ the PBKDF2 algorithm used to convert a p
>  Higher iteration counts take more time, but offer more resistance to key
>  guessing attacks.
>  The minimum is 1000 rounds and the default is 8192.
> +.It Fl s
> +Read the passphrase for the selected crypto volume from
> +.Pa /dev/stdin
> +rather than
> +.Pa /dev/tty .
>  .El
>  .Sh EXAMPLES
>  The following command, executed from the command line, would configure
> Index: bioctl.c
> ===
> RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
> retrieving revision 1.97
> diff -u -p -r1.97 bioctl.c
> --- bioctl.c  10 Jul 2010 02:56:16 -  1.97
> +++ bioctl.c  29 Nov 2010 22:17:03 -
> @@ -86,6 +86,7 @@ int rflag = 8192;
>  char *password;
> 
>  struct bio_locatebl;
> +int rpp_flag = RPP_REQUIRE_TTY;
> 
>  int
>  main(int argc, char *argv[])
> @@ -106,7 +107,7 @@ main(int argc, char *argv[])
>   if (argc < 2)
>   usage();
> 
> - while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:vu:")) !=
> + while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:svu:")) !=
>   -1) {
>   switch (ch) {
>   case 'a': /* alarm */
> @@ -174,6 +175,9 @@ main(int argc, char *argv[])
>   ss_func = BIOC_SSREBUILD;
>   al_arg = optarg;
>   break;
> + case 's':
> + rpp_flag = RPP_STDIN;
> + break;
>   case 'v':
>   verbose = 1;
>   break;
> @@ -252,12 +256,12 @@ usage(void)
>   "[-R device | channel:target[.lun]\n"
>   "\t[-u channel:target[.lun]] "
>   "device\n"
> -"   %s [-dhiPqv] "
> -"[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
> -"\t[-l special[,special,...]] [-p passfile]\n"
> -"\t[-R device | channel:target[.lun] [-r rounds] "
> + "   %s [-dhiPqsv] "
> + "[-C flag[,flag,...]] [-c raidlevel] [-k keydisk]\n"
> + "\t[-l special[,special,...]] [-p passfile]\n"
> + "\t[-R device | channel:target[.lun] [-r rounds] "
>   "device\n", __progname, __progname);
> - 
> +
>   exit(1);
>  }
> 
> @@ -1070,14 +1074,14 @@ derive_key_pkcs(int rounds, u_int8_t *ke
>   fclose(f);
>   } else {
>   if (readpassphrase(prompt, passphrase, sizeof(passphrase),
> - RPP_REQUIRE_TTY) == NULL)
> + rpp_flag) == NULL)
>   errx(1, "unable to read passphrase");
>   }
> 
>   if (verify) {
>   /* request user to re-type it */
>   if (readpassphrase("Re-type passphrase: ", verifybuf,
> - sizeof(verifybuf), RPP_REQUIRE_TTY) == NULL) {
> + sizeof(verifybuf), rpp_flag) == NULL) {
>   memset(passphrase, 0, sizeof(passphrase));
>   errx(1, "unable to read passphrase");
>   }



Re: acpithinkpad(4) fan control - sysctl callback in kernel?

2010-11-30 Thread Stuart Henderson
On 2010/11/30 09:10, Christopher Zimmermann wrote:
> Still I'd like to implement a sysctl interface. The example of
> lid_suspend did not help much. I need something like a callback when
> userspace changes the sysctl variable. Is this possible? Or should I do
> it like it is done for lid_suspend and regularly poll the variable?

Look at ddb.trigger (DBCTL_TRIGGER).



Re: acpithinkpad(4) fan control - sysctl callback in kernel?

2010-11-30 Thread Christopher Zimmermann
On 11/22/10 23:01, joshua stein wrote:
> as for code implementing the sysctl, it would probably be something
> created under machdep, like the recently added machdep.lidsuspend.

Thanks for your code. It helped me to do a first test of the fan control
on my T43. It reacts strangely (regulates fan speed on only 3 steps from
3000 to 4000 rpm).

Still I'd like to implement a sysctl interface. The example of
lid_suspend did not help much. I need something like a callback when
userspace changes the sysctl variable. Is this possible? Or should I do
it like it is done for lid_suspend and regularly poll the variable?


Christopher