Curiously, if DM_OPENPART is specified, disk_map() accepts the format "duid" as well as "duid.anypart". This may be a feature but I suspect it's actually a small oversight in the validation part.
I'm proposing this stricter (and maybe more readable) version: Index: kern/subr_disk.c =================================================================== RCS file: /home/vcs/cvs/openbsd/src/sys/kern/subr_disk.c,v retrieving revision 1.131 diff -u -p -r1.131 subr_disk.c --- kern/subr_disk.c 26 Jul 2011 12:32:14 -0000 1.131 +++ kern/subr_disk.c 2 Aug 2011 01:09:50 -0000 @@ -1467,8 +1467,10 @@ disk_map(char *path, char *mappath, int return -1; /* Verify that the device name is properly formed. */ - if (!((strlen(path) == 16 && (flags & DM_OPENPART)) || - (strlen(path) == 18 && path[16] == '.'))) + if ((strlen(path) == 16 && (flags & DM_OPENPART)) || + (strlen(path) == 18 && path[16] == '.' && !(flags & DM_OPENPART))) + ; + else return -1; /* Get partition. */