[9fans] 9p.io down?

2023-11-04 Thread Yaroslav K
Do we know what’s up with 9p.io, the current sources host?
--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T1250ef82fbb8d6ed-M83a33663f0d1ddff72587843
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Backgrounding a task

2017-10-23 Thread Yaroslav Kolomiiets
“window -m cmd” will run the command in the same namespace, forked, but in new 
window.

“-m” is for “mount”, an alternative way of communication with the window system 
to /dev/wctl which is default.

Yaroslav Kolomiiets

7 жовт. 2017 р. о 15:21 Chris McGee <newton...@gmail.com> пише:

Thanks for the tip! I'll give that a try.

Chris



З мобільного
> On Oct 7, 2017, at 12:04 AM, Skip Tavakkolian <skip.tavakkol...@gmail.com> 
> wrote:
> 
> Spitballing here: in the new window do something like
> 
> cat /proc/123/ns | rc 
> 
> Or first massage the ns then generate an output for rc.
> 
>> On Fri, Oct 6, 2017, 4:34 PM Chris McGee <newton...@gmail.com> wrote:
>> Hi All,
>> 
>> When I'm using Unix, there's a workflow that I use for long running commands 
>> that I'm hoping to find the equivalent in the Plan 9 way of doing things.
>> 
>> I will occasionally run a command, realize that it will take a long time to 
>> complete. I don't want to kill it. I'll just Ctrl-Z and bg to put it into 
>> the background using the shell. It's almost as if I had run it with '&' in 
>> the first place. I can then run other commands in the same working 
>> directory, environment and shell history.
>> 
>> Is there an equivalent to this workflow in Plan 9?
>> 
>> I realize that the whole job control system dates back to old single session 
>> terminals, which isn't a problem with Rio where you can draw new windows at 
>> will. Initially I thought, that you just drag that window to a corner 
>> somewhere and let it complete. But, if I draw a new window it won't be in 
>> the same working directory, have the same environment and namespace. Maybe 
>> there is a way to create a window that inherits these from an existing 
>> process?
>> 
>> Chris


[9fans] Fontsrv

2016-09-23 Thread Yaroslav Kolomiiets
A backport of fontsrv from p9p to Plan 9 is almost complete, based on an 
earlier port of freetype library found at mirtchovski.com. Besides TTFs, it 
happens to render most of the Type 1 fonts already there, enabling their use in 
devdraw programs.

Coming soon.

- Yaroslav



Re: [9fans] device names in venti conf

2014-04-04 Thread Yaroslav
the proposal submitted: /n/sources/patch/venti-cfgrelpath

2013-09-13 14:57 GMT+03:00 yaroslav yari...@gmail.com:
 Can we avoid explicit device names in venti conf? Changes in device
 names on new hardware cause unnecessary delays during FS recovery.

 One of available options is to modify venti so it prepends the
 non-rooted partitions with the same prefix as the config file has.
 /dev/sdC0/arenas may then have a config wired in with entries
 likeisect isect.



-- 
- Yaroslav



Re: [9fans] usb/kb: Home key produces 7

2014-04-04 Thread Yaroslav
finally got it complete: /n/sources/patch/usbkb-map

2013-08-08 19:26 GMT+03:00 Yaroslav yari...@gmail.com:
 It gets even weirder: another hack to enable F11/F12.

 /n/dump/2013/0808/sys/src/cmd/usb/kb/kb.c:473,479 -
 /sys/src/cmd/usb/kb/kb.c:473,479
   }


 - #define hasesc1(sc) (((sc) = 0x47) || ((sc) == 0x38))
 + #define hasesc1(sc) (((sc) = 0x47  (sc)  0x57) || ((sc)  0x58)
 || ((sc) == 0x38))

   static void
   putmod(KDev *f, uchar mods, uchar omods, uchar mask, uchar esc, uchar sc)

 2013/3/1 Yaroslav yari...@gmail.com:

 thanks.  that one had been bugging me.  looks like it works here.


 /n/sources/patch/usb-khome


 --
 - Yaroslav



-- 
- Yaroslav



[9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module

2013-11-27 Thread yaroslav
U9fs(4) misuses Fcall.afid in its p9any authentication module.

The afid field of Fcall structure is only valid with Tauth or Tattach.
Tread, Twrite, Tclunk should use rx-fid instead.  It's been lucky so
far to get the job done because rx-afid survives from previous
Tauth/Tattach.  The issue pops up when several authentications happen
concurrently.

Test case:
u9fs = 'host with u9fs on tcp!*!564'
9fs $u9fs; for(i in 1 2 3 4 5 6 7 8){ 9fs $u9fs  }; wait
Should:
no errors
Should not:
mount failed: authentication failed

patch/diff u9fs-afid
/sys/src/cmd/unix/u9fs/authp9any.c
authp9any.c.orig:369,375 - 
/n/sources/patch/u9fs-afid/authp9any.c:369,378
fprint(2, p9anyattach: afid %d state %d\n, rx-afid, 
sp-state);
if (sp-state == Established  strcmp(rx-uname, sp-uname) == 0
 strcmp(rx-aname, sp-aname) == 0)
+   {
+   rx-uname = sp-t.suid; /* will be valid until 
afid is clunked */
return nil;
+   }
return authentication failed;
  }
  
authp9any.c.orig:392,398 - 
/n/sources/patch/u9fs-afid/authp9any.c:395,401
char *ep;
  
Fid *f;
-   f = oldauthfid(rx-afid, (void **)sp, ep);
+   f = oldauthfid(rx-fid, (void **)sp, ep);
if (f == nil)
return ep;
if (chatty9p)
authp9any.c.orig:437,443 - 
/n/sources/patch/u9fs-afid/authp9any.c:440,446
  
Fid *f;
  
-   f = oldauthfid(rx-afid, (void **)sp, ep);
+   f = oldauthfid(rx-fid, (void **)sp, ep);
if (f == nil)
return ep;
if (chatty9p)
authp9any.c.orig:515,521 - 
/n/sources/patch/u9fs-afid/authp9any.c:518,524
AuthSession *sp;
char *ep;
  
-   f = oldauthfid(rx-afid, (void **)sp, ep);
+   f = oldauthfid(rx-fid, (void **)sp, ep);
if (f == nil)
return ep;
if (chatty9p)




Re: [9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module

2013-11-27 Thread yaroslav
  /sys/src/cmd/unix/u9fs/authp9any.c
  authp9any.c.orig:369,375 - /n/sources/patch/u9fs-afid/authp9any.c:369,378
  fprint(2, p9anyattach: afid %d state %d\n, rx-afid, sp-state);
  if (sp-state == Established  strcmp(rx-uname, sp-uname) == 0
   strcmp(rx-aname, sp-aname) == 0)
  + {
  + rx-uname = sp-t.suid; /* will be valid until afid is clunked */
  return nil;
  + }
  return authentication failed;
  }
 
 without commont on correctness, braces go on the
 line on which the if condition ends.
 
 - erik
  

The patch has been updated.

BTW, this change was after http://9fans.net/archive/2011/10/157 which
I hadn't then submitted; this time it slipped through.

It worth's to stay though, IMO.




Re: [9fans] device names in venti conf

2013-09-13 Thread yaroslav
 Can we avoid explicit device names in venti conf? Changes in device
 names on new hardware cause unnecessary delays during FS recovery.

One of available options is to modify venti so it prepends the
non-rooted partitions with the same prefix as the config file has.
/dev/sdC0/arenas may then have a config wired in with entries
likeisect isect.
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:44,49 - 
/sys/src/cmd/venti/srv/config.c:44,55
return 0;
  }
  
+ static int
+ isrooted(char* s)
+ {
+   return *s == '/' || *s == '#';
+ }
+ 
  /*
   * configs:
   *| configs config
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:69,75 - 
/sys/src/cmd/venti/srv/config.c:75,81
ArenaPart **av;
ISect **sv;
IFile f;
-   char *s, *line, *flds[MaxArgs + 1];
+   char *s, *p, *q, *line, *flds[MaxArgs + 1];
int i, ok;
  
if(readifile(f, file)  0)
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:78,83 - 
/sys/src/cmd/venti/srv/config.c:84,98
config-mem = Unspecified;
ok = -1;
line = nil;
+   
+   /* conf basename as default prefix for partitions */
+   p = estrdup(file);
+   s = strrchr(p, '/');
+   if(s)
+   *s = 0;
+   else
+   *p = 0;
+ 
for(;;){
s = ifileline(f);
if(s == nil){
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:92,98 - 
/sys/src/cmd/venti/srv/config.c:107,118
sv[i] = config-sects[i];
free(config-sects);
config-sects = sv;
-   config-sects[config-nsects] = configisect(flds[1]);
+   if(!isrooted(flds[1])){
+   q = smprint(%s/%s, p, flds[1]);
+   config-sects[config-nsects] = configisect(q);
+   free(q);
+   }else
+   config-sects[config-nsects] = 
configisect(flds[1]);
if(config-sects[config-nsects] == nil)
break;
config-nsects++;
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:102,108 - 
/sys/src/cmd/venti/srv/config.c:122,133
av[i] = config-aparts[i];
free(config-aparts);
config-aparts = av;
-   config-aparts[config-naparts] = configarenas(flds[1]);
+   if(!isrooted(flds[1])){
+   q = smprint(%s/%s, p, flds[1]);
+   config-aparts[config-naparts] = 
configarenas(q);
+   free(q);
+   }else
+   config-aparts[config-naparts] = 
configarenas(flds[1]);
if(config-aparts[config-naparts] == nil)
break;
config-naparts++;
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:111,117 - 
/sys/src/cmd/venti/srv/config.c:136,148
seterr(EAdmin, duplicate bloom lines in 
configuration file %s, file);
break;
}
-   if((config-bloom = configbloom(flds[1])) == nil)
+   if(!isrooted(flds[1])){
+   q = smprint(%s/%s, p, flds[1]);
+   config-bloom = configbloom(q);
+   free(q);
+   }else
+   config-bloom = configbloom(flds[1]);
+   if(config-bloom == nil)
break;
}else if(i == 2  strcmp(flds[0], index) == 0){
if(nameok(flds[1])  0){
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:183,188 - 
/sys/src/cmd/venti/srv/config.c:214,220
free(line);
line = nil;
}
+   free(p);
free(line);
freeifile(f);
if(ok  0){

[9fans] device names in venti conf

2013-09-12 Thread Yaroslav
Can we avoid explicit device names in venti conf? Changes in device
names on new hardware cause unnecessary delays during FS recovery.



[9fans] xen3: fresh build 9xenpccpuf dies on boot

2013-09-12 Thread Yaroslav
Re-build of 9xenpccpuf, the PV Xen guest kernel built from sources at
/n/sources/xen/xen3/9), with latest changes in sys/src/9/port/,
sys/src/libc/ and others - resulted in non-functional kernel: it dies
on boot with attached diagnostics.
I haven't looked further yet.
attachment: xen.png

Re: [9fans] xen3: fresh build 9xenpccpuf dies on boot

2013-09-12 Thread Yaroslav
 The crash seems to be in init, not the kernel.  Are you sure
 your file system image is good?

it doesn't get far enough for root from:, so it seems to fail
somewhere in the initcode blob



Re: [9fans] usb/kb: Home key produces 7

2013-08-08 Thread Yaroslav
It gets even weirder: another hack to enable F11/F12.

/n/dump/2013/0808/sys/src/cmd/usb/kb/kb.c:473,479 -
/sys/src/cmd/usb/kb/kb.c:473,479
  }


- #define hasesc1(sc) (((sc) = 0x47) || ((sc) == 0x38))
+ #define hasesc1(sc) (((sc) = 0x47  (sc)  0x57) || ((sc)  0x58)
|| ((sc) == 0x38))

  static void
  putmod(KDev *f, uchar mods, uchar omods, uchar mask, uchar esc, uchar sc)

2013/3/1 Yaroslav yari...@gmail.com:

 thanks.  that one had been bugging me.  looks like it works here.


 /n/sources/patch/usb-khome


-- 
- Yaroslav



Re: [9fans] mallocz in APE

2013-07-18 Thread Yaroslav
 Replacing _MALLOCZ back with mallocz within APE realm seems to me a
 better option to consider.

 I don't think this is better. APE generally tries very hard to be compliant
 to the spirit of ANSI (or POSIX with _POSIX_EXTENSION defined), this
 includes not poluting the namespace with plan9isms where possible.

 Having said this what about setmalloctag() getcallerpc(), etc etc.

It is internal to the libraries and is not exposed to the APE apps, right?



[9fans] lpdaemon

2013-06-05 Thread yaroslav
in /sys/src/cmd/lp/lpdaemon.c:297,310

These
info.host[strlen(info.host)] = '\0';
…
info.user[strlen(info.user)] = '\0';

look nonsence as zeros are placed exactly where they already are.
Should read as in following instead:

info.host[NAMELEN] = '\0';
…
info.user[NAMELEN] = '\0';

shoudn't it?




[9fans] vncv sw cursor trail

2013-05-07 Thread Yaroslav
When using vncv on a terminal with software cursor (vesa, rpi) the
mouse cursor leaves a trail.  This seem to be caused by the fact that
vncv loads picture updates with loadimage(2) directly to screen.
Loading to an offscreen image followed by a draw(2) to screen removes
the artifact:

/n/dump/2013/0507/sys/src/cmd/vnc/draw.c:106,111 -
/sys/src/cmd/vnc/draw.c:106,112
  static void
  updatescreen(Rectangle r)
  {
+ Image* img;
  int b, bb;

  lockdisplay(display);
/n/dump/2013/0507/sys/src/cmd/vnc/draw.c:120,129 -
/sys/src/cmd/vnc/draw.c:121,135
  /*
  * assume load image fails only because of resize
  */
+ img = allocimage(display, r, screen-chan, 0, DNofill);
+ if(img == nil)
+ sysfatal(updatescreen: %r);
  b = Dx(r) * pixb * Dy(r);
- bb = loadimage(screen, rectaddpt(r, screen-r.min), pixbuf, b);
+ bb = loadimage(img, r, pixbuf, b);
  if(bb != b  verbose)
  fprint(2, loadimage %d on %R for %R returned %d: %r\n, b,
rectaddpt(r, screen-r.min), screen-r, bb);
+ draw(screen, rectaddpt(r, screen-r.min), img, nil, r.min);
+ freeimage(img);
  unlockdisplay(display);
  }

Submitted as /n/sources/patch/vncv-curtrail
--
- Yaroslav



Re: [9fans] [GSOC 2013] Implement plan9 commands in Go, Goblin

2013-05-03 Thread Yaroslav
2013/5/1 Steve Simon st...@quintile.net:
 There has been a win32.c in the labs distribution of rc(1) for years
 but it has never (to my knowledge) worked.

 I did a major overhall of the win32 port and back ports of a few
 plan9 tools to posix (I know, I know), and packaged the whole thing up.

sounds like it deserves to become submitted as a patch.

--
- Yaroslav



Re: [9fans] German USB keyboard on Raspberry Pi

2013-04-26 Thread Yaroslav
2013/4/25 Holger Sebert holger.seb...@ruhr-uni-bochum.de:
 If not, how do I recompile and install the kbd-module on the
 Raspberry Pi? I changed kbd.c for testing purposes and
 executed mk install in the directory /sys/src/9/. Although
 the build succeeded the changes did not seem to be incorporated.

mk install usually installs the kernel to /$objtype, but rpi boots
from dos partition of an SD card, therefore you also need to copy it
over there:
; dosmnt 1 /n/dos
; cp /arm/9pi /n/dos/
; unmount /n/dos  # or simply close the window

--
- Yaroslav



[9fans] fresh python port?

2013-04-25 Thread Yaroslav
There is porting of a recent 2.x python going on, isn't it? How is it going?



Re: [9fans] Go Plan9 ARM Dreamplug

2013-04-17 Thread Yaroslav
2013/4/15 Christopher Nielsen cniel...@pobox.com

 A small caveat, I had to use mercurial on x86 (my cpufsauth server is an x86 
 vmware instance), since there wasn't an arm binary. Other than that, it was 
 all pretty painless.


One may '9fs sources  fcp /n/sources/contrib/yk/5.python
/arm/bin/python' to add the ARM binary (without VFP instructions).

--
- Yaroslav



Re: [9fans] Fsctotum per user instances?

2013-04-08 Thread Yaroslav
Not exactly. Please refer to /sys/doc/auth.ps |
http://plan9.bell-labs.com/sys/doc/auth.html for overview of the
architecture.

 So the incoming authentication is handled by the cpu owner factotum? That
 means the authentication information is held by the cpu owner factotum and
 the user factotum just handles the users keys? And the user factotum is run
 after authentication.



Re: [9fans] Unexpected complaint

2013-04-02 Thread Yaroslav
works as expected if given %llud format.


2013/4/2 lu...@proxima.alt.za

 The following code triggers a warning:

 #include u.h
 #include libc.h

 int main() {
 unsigned long long val = 0;

 print(VAL: %llu\n, val);
 return 0;
 }

 warning: llu.c:7 format mismatch llu
  UVLONG, arg 2

 and produces the damnedest output:

 VAL: %
 %(not terminated by a newline).

 Something's not right, anybody know what the cause is?  And maybe the
 cure?

 ++L





-- 
- Yaroslav


Re: [9fans] cs syntax

2013-04-01 Thread Yaroslav
/sys/src/cmd/ndb/cs.c:/^rwrite/;/^}/ looks like a rather complete reference

☺


Re: [9fans] 9FRONT ANNOUNCES INTEL WIFI DRIVER, WPA/WPA2 SUPPORT

2013-04-01 Thread Yaroslav
Looking forward to a backport of this to the stock Plan 9.


Re: [9fans] Detecting keyup/keydown

2013-04-01 Thread Yaroslav
no, cons(3) interface abstracts away from key strokes and yields complete
Runes.


Re: [9fans] Git (Was: Acme: indicator of running process)

2013-03-05 Thread Yaroslav
 is it too much noise to ask about p9p Acme on this mailing list?

Should be ok for anything with a 9 in its name



[9fans] usb/kb: Home key produces 7

2013-03-01 Thread yaroslav
The Home key produces rune 7 on certain USB keyboard. The fix is:

/n/sources/plan9/sys/src/cmd/usb/kb/kb.c:473,479 - 
/sys/src/cmd/usb/kb/kb.c:473,479
  }
  
  
- #define hasesc1(sc)   (((sc)  0x47) || ((sc) == 0x38))
+ #define hasesc1(sc)   (((sc) = 0x47) || ((sc) == 0x38))
  
  static void
  putmod(KDev *f, uchar mods, uchar omods, uchar mask, uchar esc, uchar sc)




Re: [9fans] usb/kb: Home key produces 7

2013-03-01 Thread Yaroslav
 thanks.  that one had been bugging me.  looks like it works here.


/n/sources/patch/usb-khome


Re: [9fans] APE select() and awkward Python subprocess PIPEfitting

2013-02-26 Thread Yaroslav
2013/2/26 Jeff Sickel j...@corpus-callosum.com

 've come to the conclusion that the code that causes error is intentional


We're facing problems in ceratin python apps too[1].
We used to use X11/equis mainly for rdesktop until a native port[2] became
available.

Does you change break X11/equis if relinked?

- Yaroslav

_
[1] http://9fans.net/archive/2013/01/95
[2] http://9fans.net/archive/2013/02/58


Re: [9fans] tell if our window has been hidden

2013-02-14 Thread Yaroslav
did just that, thanks.


2013/2/12 Federico G. Benavento benave...@gmail.com

 you can read from /dev/wctl and check wether the window
 is visible or hidden, see rio(4).

 On Feb 11, 2013, at 7:32 AM, Yaroslav yari...@gmail.com wrote:

  Can we tell somehow from eresized() that our window has been hidden or
 unhidden?
  --
  - Yaroslav

 ---
 Federico G. Benavento
 benave...@gmail.com







-- 
- Yaroslav


[9fans] xor draw

2013-02-14 Thread Yaroslav
we can't do XOR drawing with draw(2) like with bitblt, can we?

-- 
- Yaroslav


Re: [9fans] xor draw

2013-02-14 Thread Yaroslav
2013/2/14 erik quanstrom quans...@quanstro.net

 On Thu Feb 14 13:52:09 EST 2013, yari...@gmail.com wrote:

  we can't do XOR drawing with draw(2) like with bitblt, can we?

 if there's a trivial α channel, it's possible.  otherwise one
 runs the risk of α multiplication.


No alpha there - I'd like to learn the trick please.


[9fans] tell if our window has been hidden

2013-02-11 Thread Yaroslav
Can we tell somehow from eresized() that our window has been hidden or
unhidden?
-- 
- Yaroslav


Re: [9fans] APE libsec

2013-02-08 Thread Yaroslav
2013/2/5 erik quanstrom quans...@quanstro.net

 looks good, but i'd do libsec at the same time.
 unless you know of a compelling reason for these
 to support a different set of algorithms?


Agree.

/n/sources/patch/x509-oids


[9fans] meet native port of rdesktop 1.6

2013-02-08 Thread Yaroslav
/n/sources/contrib/yk/rdesktop

It supports RGB16 server output only and doesn't implement graphic orders
beyond bitmap update. Tested against XP and servers 2003, 2008, 2012.

-- 
- Yaroslav Kolomiyets


Re: [9fans] APE libsec

2013-02-05 Thread yaroslav
Could you please include following changes to
/sys/src/ape/lib/sec/port/x509-ape.c: this is for X509toRSApub(2) to
accept some ms-generated certs:

/n/sources/plan9/sys/src/ape/lib/sec/port/x509-ape.c:1583,1588 - 
/sys/src/ape/lib/sec/port/x509-ape.c:1583,1590
ALG_sha1WithRSAEncryption,
ALG_sha1WithRSAEncryptionOiw,
ALG_md5,
+   ALG_sha256WithRSAEncryption,
+   ALG_shaWithRSASignatureOiw,
NUMALGS
  };
  typedef struct Ints7 {
/n/sources/plan9/sys/src/ape/lib/sec/port/x509-ape.c:1596,1601 - 
/sys/src/ape/lib/sec/port/x509-ape.c:1598,1605
  static Ints7 oid_sha1WithRSAEncryption ={7, 1, 2, 840, 113549, 1, 1, 5 };
  static Ints7 oid_sha1WithRSAEncryptionOiw ={6, 1, 3, 14, 3, 2, 29 };
  static Ints7 oid_md5 ={6, 1, 2, 840, 113549, 2, 5, 0 };
+ static Ints7 oid_sha256WithRSAEncryption ={7, 1, 2, 840, 113549, 1, 1, 11 };
+ static Ints7 oid_shaWithRSASignatureOiw ={6, 1, 3, 14, 3, 2, 15 };
  static Ints *alg_oid_tab[NUMALGS+1] = {
(Ints*)oid_rsaEncryption,
(Ints*)oid_md2WithRSAEncryption,
/n/sources/plan9/sys/src/ape/lib/sec/port/x509-ape.c:1604,1609 - 
/sys/src/ape/lib/sec/port/x509-ape.c:1608,1615
(Ints*)oid_sha1WithRSAEncryption,
(Ints*)oid_sha1WithRSAEncryptionOiw,
(Ints*)oid_md5,
+   (Ints*)oid_sha256WithRSAEncryption,
+   (Ints*)oid_shaWithRSASignatureOiw,
nil
  };
  static DigestFun digestalg[NUMALGS+1] = { md5, md5, md5, md5, sha1, sha1, 
md5, nil };
#include u.h
#include libc.h
#include mp.h
#include libsec.h

typedef DigestState*(*DigestFun)(uchar*,ulong,uchar*,DigestState*);

/* ANSI offsetof, backwards. */
#define OFFSETOF(a, b)  offsetof(b, a)

/*=*/
/*  general ASN1 declarations and parsing
 *
 *  For now, this is used only for extracting the key from an
 *  X509 certificate, so the entire collection is hidden.  But
 *  someday we should probably make the functions visible and
 *  give them their own man page.
 */
typedef struct Elem Elem;
typedef struct Tag Tag;
typedef struct Value Value;
typedef struct Bytes Bytes;
typedef struct Ints Ints;
typedef struct Bits Bits;
typedef struct Elist Elist;

/* tag classes */
#define Universal 0
#define Context 0x80

/* universal tags */
#define BOOLEAN 1
#define INTEGER 2
#define BIT_STRING 3
#define OCTET_STRING 4
#define NULLTAG 5
#define OBJECT_ID 6
#define ObjectDescriptor 7
#define EXTERNAL 8
#define REAL 9
#define ENUMERATED 10
#define EMBEDDED_PDV 11
#define UTF8String 12
#define SEQUENCE 16 /* also SEQUENCE OF */
#define SETOF 17/* also SETOF OF */
#define NumericString 18
#define PrintableString 19
#define TeletexString 20
#define VideotexString 21
#define IA5String 22
#define UTCTime 23
#define GeneralizedTime 24
#define GraphicString 25
#define VisibleString 26
#define GeneralString 27
#define UniversalString 28
#define BMPString 30

struct Bytes {
int len;
uchar   data[1];
};

struct Ints {
int len;
int data[1];
};

struct Bits {
int len;/* number of bytes */
int unusedbits; /* unused bits in last byte */
uchar   data[1];/* most-significant bit first */
};

struct Tag {
int class;
int num;
};

enum { VBool, VInt, VOctets, VBigInt, VReal, VOther,
VBitString, VNull, VEOC, VObjId, VString, VSeq, VSet };
struct Value {
int tag;/* VBool, etc. */
union {
int boolval;
int intval;
Bytes*  octetsval;
Bytes*  bigintval;
Bytes*  realval;/* undecoded; hardly ever used */
Bytes*  otherval;
Bits*   bitstringval;
Ints*   objidval;
char*   stringval;
Elist*  seqval;
Elist*  setval;
} u;  /* (Don't use anonymous unions, for ease of porting) */
};

struct Elem {
Tag tag;
Value   val;
};

struct Elist {
Elist*  tl;
Elemhd;
};

/* decoding errors */
enum { ASN_OK, ASN_ESHORT, ASN_ETOOBIG, ASN_EVALLEN,
ASN_ECONSTR, ASN_EPRIM, ASN_EINVAL, ASN_EUNIMPL };


/* here are the functions to consider making extern someday */
static Bytes*   newbytes(int len);
static Bytes*   makebytes(uchar* buf, int len);
static void freebytes(Bytes* b);
static Bytes*   catbytes(Bytes* b1, Bytes* b2);
static Ints*newints(int len);
static Ints*makeints(int* buf, int len);
static void freeints(Ints* b);
static Bits*newbits(int len);
static Bits*makebits(uchar* buf, int len, int unusedbits);
static void freebits(Bits* b);
static Elist*   mkel(Elem e, Elist* tail);
static void freeelist(Elist* el);
static int  elistlen(Elist* el);
static int  is_seq(Elem* pe, Elist** pseq);
static int  is_set(Elem* pe, Elist** pset);
static int  

[9fans] APE libsec

2013-02-04 Thread Yaroslav
Hi,

I've noticed there are libsec/libmp became available for APE programs, and
dove into replacing OpenSSL calls with libsec equivalents. However, there
are still a reference to the native libc lurks somewhere in the ports as
the linker reports conflicts like these:

checkenv: incompatible type signatures
a9aa533a(/386/lib/ape/libap.a(freopen)) and
aebfd74f(/386/lib/libc.a(calloc)) for open
ppanic: incompatible type signatures
4dcf09c4(/386/lib/ape/libap.a(_IO_putc)) and
55e8553c(/386/lib/libc.a(calloc)) for write
malloc: /386/lib/libc.a(calloc): redefinition: malloc
(1070) TEXT malloc+0(SB),$24
free: /386/lib/libc.a(calloc): redefinition: free
...

Could someone suggest a method for tracking down the library/object file
which contains the loader instruction to load /386/lib/libc.a?

Thanks.
-- 
- Yaroslav


Re: [9fans] APE libsec

2013-02-04 Thread Yaroslav
Aha! This ape/mp.h references the native lib not ape one. Applying the fix
below and recompiling ape/lib/mp and ape/lib/sec eliminates the reference
to /386/lib/libc.a, leaving just a few of unresolved references:
pcc -o 8.out bitmap.8 cache.8 channels.8 cliprdr.8 ewmhints.8 frpc.8 iso.8
licence.8 mcs.8 mppc.8 orders.8 pstcache.8 rdesktop.8 rdp.8 rdp5.8
seamless.8 secure.8 tcp.8 snarf.8 xkeymap.8 xwin.8
mpkaratsuba: undefined: mallocz
_PIPE: argv0: not defined
pcc: 8l: 8l 97689: error

The mp.h fix:

/n/sources/plan9/sys/include/ape/mp.h:5,12 - /sys/include/ape/mp.h:5,12
  #ifndef __LIBMP_H_
  #define __LIBMP_H_

- #pragma src /sys/src/libmp
- #pragma lib libmp.a
+ #pragma src /sys/src/ape/lib/mp
+ #pragma lib /$M/lib/ape/libmp.a

  typedef unsigned int mpdigit; /* from /$objtype/include/u.h */




2013/2/4 Yaroslav yari...@gmail.com

 Hi,

 I've noticed there are libsec/libmp became available for APE programs, and
 dove into replacing OpenSSL calls with libsec equivalents. However, there
 are still a reference to the native libc lurks somewhere in the ports as
 the linker reports conflicts like these:

 checkenv: incompatible type signatures
 a9aa533a(/386/lib/ape/libap.a(freopen)) and
 aebfd74f(/386/lib/libc.a(calloc)) for open
 ppanic: incompatible type signatures
 4dcf09c4(/386/lib/ape/libap.a(_IO_putc)) and
 55e8553c(/386/lib/libc.a(calloc)) for write
 malloc: /386/lib/libc.a(calloc): redefinition: malloc
 (1070) TEXT malloc+0(SB),$24
 free: /386/lib/libc.a(calloc): redefinition: free
 ...

 Could someone suggest a method for tracking down the library/object file
 which contains the loader instruction to load /386/lib/libc.a?

 Thanks.
 --
 - Yaroslav




-- 
- Yaroslav


[9fans] ape: getsockname: wrong byte order in sin_port

2013-01-08 Thread Yaroslav
APE's getsockname() returns port with bytes swapped (on 386).
Fix:

/n/dump/2013/0108/sys/src/ape/lib/bsd/_sock_ingetaddr.c:35,41 -
/sys/src/ape/lib/bsd/_sock_ingetaddr.c:35,41
  if(p){
  *p++ = 0;
  ip-sin_family = AF_INET;
- ip-sin_port = atoi(p);
+ ip-sin_port = htons(atoi(p));
  ip-sin_addr.s_addr = inet_addr(name);
  if(alen)
  *alen = sizeof(struct sockaddr_in);

Python needs to be relinked.
-- 
- Yaroslav


Re: [9fans] Mercurial and Plan 9

2013-01-07 Thread Yaroslav
We have problems with threading support in the mentioned APE python
port (e.g. hg serve): they complain about invalid file descriptors
which may be due to non-reentrant implementation of APE interfaces. I
didn't look any deeper though.

2013/1/5 Federico G. Benavento benave...@gmail.com:
 Hola Steven,

 thanks for getting mercurial support for Plan 9 upstream,
 I did the APE port of python (based on the native one) years ago
 because nothing worked with the native one, I wanted to get X
 running then it needed openssl or some socket api that wasn't
 implemented in the Plan 9 emulation of it (written in python as
 charles mentions), because native python didn't have sockets
 and things like non-blocking IO provided by APE's select.

 basically you're left out with the Language but without significant
 parts of the runtime when you use a native port.

 thanks again


 On Jan 4, 2013, at 8:10 PM, Steven Stallion sstall...@gmail.com wrote:

 Hi Jeff,

 Mercurial has been taken care of! I more or less track the latest stable 
 (stallion/mercurial). The existing Python port is sufficient for Mercurial, 
 though having a native Python port would be great. I've added Plan 9 support 
 upstream in the Mercurial repository, so future builds are very simple. In 
 fact, it's even documented: 
 http://mercurial.selenic.com/wiki/Plan9FromBellLabs

 Cheers,

 Steve

 On Fri, Jan 4, 2013 at 1:56 PM, Jeff Sickel j...@corpus-callosum.com wrote:
 Has anyone completed an APE lib sec yet?

 I'm starting to roll an ape build of libsec in as it's needed for
 a new Python 2.7.3+ port of Python.  I'd gladly take someone else's
 mkfile rework to save some time.  Libsec is needed to implement a
 new _hashlib module, one that doesn't require OpenSSL among others.

 The new Python releasebuild will be pushed out once I clean up
 a few more details like getting new builds of Mercurial working.


 ---
 Federico G. Benavento
 benave...@gmail.com







-- 
- Yaroslav



[9fans] bug in topng(1)

2012-12-24 Thread yaroslav
There's a bug in topng(1) which under certain circumstances may result in
broken output image.  When such an image then is fed to png(1)
diagnostics like the following are produced:

term% png /tmp/1.png
png: unknown filtering scheme 49

(The filtering scheme number may differ.)

This happens when at the beginning of an input line (z-x == 0) there
are only room for exactly one pixel in output buffer (b+pixwids == e),
at /sys/src/cmd/jpg/writepng.c:/^zread/+/while/.

Since every scan line should start with a filter algorithm ID it
consumes a byte in the buffer, leaving no room for the pixel.  The
pixels variable turns zero, no pixels are emitted, yet the alg byte
slips out.  During next run of zread() with empty buffer, the alg byte
is emitted again, causing permanent skew of output bytes.

The proposed fix is to modify the loop condition so the loop won't
proceed if there are not enough room for at least one pixel plus a
byte for the filter alg ID.

Submitted /n/sources/patch/topng-extrabyte/.

- yk




Re: [9fans] p9p srv files on plan 9

2012-09-19 Thread Yaroslav
you may mount it on terminal (9pfuse or so) then access in drawterm
under /mnt/term.

2012/9/15 Anthony Sorace a...@9srv.net:
 i'm certain i've seen this, but i can't reproduce it: is there a
 method for getting the srv files created by p9p in $namespace
 mounted under plan9? attempting to do so under drawterm
 objects Operation not supported on socket.



[9fans] (no subject)

2012-09-03 Thread yaroslav
subect: update:V: in system mkfiles

Many system mkfiles have targets like this:

update:V:
update $UPDATEFLAGS $UPDATE

These're no program named 'update' however — besides pc/update which
doesn't seem to apply here.

Could somebody please advise what these are meant for?  Is it still
relevant?

Thanks.

- yk




[9fans] APE rename: wstat for 'none'

2012-08-23 Thread Yaroslav
Is there a specific reason of forbidding wstat for 'none' in fossil
(/sys/src/cmd/fossil/9p.c:130,133)?
This causes APE rename() to fail almost always
(/sys/src/ape/lib/ap/plan9/rename.c:43)

Perhaps rename() should be fixed to match mv (/sys/src/cmd/mv.c:/^mv1)
to go around this?
-- 
- Yaroslav



Re: [9fans] APE rename: wstat for 'none'

2012-08-23 Thread Yaroslav
 why is this related to ape?  if you are none, then you are limited
 as to what you can do on the file server.  you may just have an auth problem.

APE implements rename() in terms of wstat or copying. It's just
doesn't try to work around failing wstat (that's perhaps a good thing)
while mv does.

There are no auth problem since I deliberatly run the python web app
as none, not willing to give it eve's powers.



Re: [9fans] APE rename: wstat for 'none'

2012-08-23 Thread Yaroslav
 are you sure?

 ; touch bz
 ; ratrace -c mv  bz bw [2=1]| grep -v 'Stat|Brk'

you forgot auth/none...

; ratrace -c auth/none mv  bz bw [2=1]| grep -v ' none |Stat|Brk'
209051 mv Wstat 8cfe 0xdfffcef4/bz 0xc708 51 = -1 './bw' file does
not exist 1345738572648442848 1345738572649648848
209051 mv Open 3e05 0xdfffcef4/bz 0x0 = 3  1345738572649753608
1345738572650669632
209051 mv Create 3e0d 0xdfffdef4/./bw 0x1 0x1b6 = 4 
1345738572651647673 1345738572653507377
209051 mv Pread 8d16 3 0xdfffae8c 8192 -1/ 8192 -1 = 0 file does not
exist 1345738572653614652 1345738572654039559
209051 mv Close 3e15 3 = 0  1345738572654426753 1345738572654851661
209051 mv Fwstat 8d1e 4 0xc708 49 = -1 './bw' file does not exist
1345738572655401443 1345738572655739187
209051 mv Remove 3dfd 0xdfffcef4/bz = 0  1345738572656063524
1345738572656922558
209051 mv Close 3e15 4 = 0  1345738572657094365 1345738572657555310
209051 mv Open 3e05 0xbbe4/#c/pid 0x0 = 3  1345738572657805897
1345738572657894733
209051 mv Pread 8d16 3 0xdfffeefc 20 -1 0xdfffeefc/.209051. 20
-1 = 12  1345738572658193929 1345738572658201471
209051 mv Close 3e15 3 = 0  1345738572658351488 1345738572658359031
209051 mv Exits 3e1d 0/



Re: [9fans] APE rename: wstat for 'none'

2012-08-23 Thread Yaroslav
 no, i didn't.  ratrace doesn't run if you're none.

try 'ratrace -c auth/none cmd ...' while not being none
and ignore everything preceding Exec cmd.

 as i understand it, your claim is that mv works as none but ape/rename
 does not and this is because ape/rename uses wstat.

both use wstat or copying; what's different is how they choose what to use.
mv falls back to copying if wstat fails; ape/rename does not.



Re: [9fans] APE rename: wstat for 'none'

2012-08-23 Thread Yaroslav
 oh, i thought you were comparing system/library calls, not library function
 vs program.  i don't understand that comparison.

it so happens that mv is a program with own idea how to do renames,
and there are no other obvious subject to compare with.



[9fans] syscall tracing: errstr

2012-08-23 Thread Yaroslav
Anybody else noticed ratrace reporting an older errstr?

209051 mv Wstat 8cfe 0xdfffcef4/bz 0xc708 51 = -1 './bw' file does
not exist 1345738572648442848 1345738572649648848

I double checked: the wstat definitely returns Eperm on the wire:

Twstat tag 15 fid 1352 stat 'bw' '' '' '' q (
4294967295 dalA) m 0377 at -1 mt -1 l -1 t 65535 d -1
Rerror tag 15 ename permission denied

Looking at /n/sources/plan9/sys/src/9/pc/trap.c:729,731 -- maybe
sysretfmt() should take up-syserrstr not up-errstr?




-- Forwarded message --
From: Yaroslav yari...@gmail.com
Date: 2012/8/23
Subject: Re: [9fans] APE rename: wstat for 'none'
To: Fans of the OS Plan 9 from Bell Labs 9fans@9fans.net


 are you sure?

 ; touch bz
 ; ratrace -c mv  bz bw [2=1]| grep -v 'Stat|Brk'

you forgot auth/none...

; ratrace -c auth/none mv  bz bw [2=1]| grep -v ' none |Stat|Brk'
209051 mv Wstat 8cfe 0xdfffcef4/bz 0xc708 51 = -1 './bw' file does
not exist 1345738572648442848 1345738572649648848
209051 mv Open 3e05 0xdfffcef4/bz 0x0 = 3  1345738572649753608
1345738572650669632
209051 mv Create 3e0d 0xdfffdef4/./bw 0x1 0x1b6 = 4 
1345738572651647673 1345738572653507377
209051 mv Pread 8d16 3 0xdfffae8c 8192 -1/ 8192 -1 = 0 file does not
exist 1345738572653614652 1345738572654039559
209051 mv Close 3e15 3 = 0  1345738572654426753 1345738572654851661
209051 mv Fwstat 8d1e 4 0xc708 49 = -1 './bw' file does not exist
1345738572655401443 1345738572655739187
209051 mv Remove 3dfd 0xdfffcef4/bz = 0  1345738572656063524
1345738572656922558
209051 mv Close 3e15 4 = 0  1345738572657094365 1345738572657555310
209051 mv Open 3e05 0xbbe4/#c/pid 0x0 = 3  1345738572657805897
1345738572657894733
209051 mv Pread 8d16 3 0xdfffeefc 20 -1 0xdfffeefc/.209051. 20
-1 = 12  1345738572658193929 1345738572658201471
209051 mv Close 3e15 3 = 0  1345738572658351488 1345738572658359031
209051 mv Exits 3e1d 0/


-- 
- Yaroslav



Re: [9fans] apparently nice summary of small linux pcs

2012-06-18 Thread Yaroslav
do you mind quoting it here?

2012/6/17 Nick LaForge nicklafo...@gmail.com:
 I'm still a little hesitant
 about Nvidia, but to avoid further damaging relations with processor
 designers I'll defer to Torvalds' statement on the matter from
 Thursday in Finland.



Re: [9fans] Mini PCs

2012-06-14 Thread Yaroslav
2012/6/12 Wes Kussmaul w...@authentrus.com:
 When you send an xkcd link to a large list, you make a dent in the
 world's productivity. You can't look at just one.

You have no idea how much right you are!



Re: [9fans] dejavu sans

2012-06-14 Thread Yaroslav
2012/6/12  s...@9front.org:
 In native, I no longer benefit from X11's rendering. Here, blurry
 fonts look blurry.

Sorry, is it DVI or VGA-connected?



Re: [9fans] dejavu sans

2012-06-14 Thread Yaroslav
 Primarily DVI, but also observed with VGA.
 LCD screens, in all cases.

can you look at pixels through a magnifying glass and see if an image
pixel affects more than one physical one? may it happen there's a
resolution mismatch?

VGAs can have artifacts which is very hard to get fixed: it is very
important to get proper timining of video modes (things like refresh
hz, sync +/- etc.) even though resolutions are identical. The other
day I've got to craft custom vgadb entries using values captured by
X11 through DDC.



Re: [9fans] the `Look' command in Acme

2012-05-18 Thread Yaroslav
2012/5/18 Peter A. Cejchan tyap...@gmail.com:
 select text in the first window

  2-1 chord on Look in the second window's tag line


 how about running a command from another window, w/o copying to the tagline?

This is it: you don't copy to the tagline but just pass last selection
as an argument.



Re: [9fans] Starting a blog on plan 9

2012-05-08 Thread Yaroslav
 Could you elaborate on your choice of using sam -d?

Agree, 'sam -d' is not an entry-level choice.



Re: [9fans] Mercurial port is official

2012-04-27 Thread Yaroslav
Outstanding! Thanks a lot!



Re: [9fans] Summary of acme chords

2012-04-25 Thread Yaroslav
not on the table: B2+B1 passes dot as arg to the cmd



Re: [9fans] Plan 9 keyboard and mouse

2012-04-24 Thread Yaroslav
 I have a question about keyboard and mouse interaction in the OS that
 relates to fast keys available for the windows. Do any exist for use of say
 windows switching, closing or any other operations for menus within plan 9?

The fast keys are mouse buttons, that's it. Just take it: once you get
used to it you'll feel allright about this.



Re: [9fans] SSHv2

2012-03-30 Thread Yaroslav
 How big is the dependency on p9p factotum?  Is it just syntactic or
 is there some needed functionality in p9p factotum which the sources
 version doesn't provide?

It's a strong one: it implements DSA sign/verify.

BTW, without patching ndb/cs as mentioned before one won't be able to
connect by DNS names.



Re: [9fans] SSHv2

2012-03-30 Thread Yaroslav
 contrib/quanstro/root/sys/src/cmd/auth/factotum

Nfactotum misses proto=mschap which is used by cifs(4) for doing NTLM.



Re: [9fans] SSHv2

2012-03-30 Thread Yaroslav
 contrib/blstuart/ssh

It's great! All thumbs up!

Would it be hard to add cooked mode (-C)?

-- 
- Yaroslav



Re: [9fans] SSHv2

2012-03-30 Thread Yaroslav
 Would it be hard to add cooked mode (-C)?

never mind: it's easy to simulate by binding /dev/nul over /dev/consctl.



[9fans] rc: fn name @{block}

2012-03-30 Thread Yaroslav
fn name @{block} doesn't cause block to run in a sub-shell, although
it accepts the syntax.
Is it someting should not be tried, or something shoud be fixed?



Re: [9fans] SSHv2

2012-03-30 Thread Yaroslav
2012/3/30 erik quanstrom quans...@quanstro.net:
 contrib/quanstro/root/sys/src/cmd/auth/factotum

 contrib/install quanstro/nfactotum.  move your old factotum out of the way
 first.

here's how one may work out contrib/install conflicts:

% contrib/install quanstro/nfactotum # may report conflicts
% replica/pull -v -s/ /dist/replica/nfactotum # resolves the conflicts



[9fans] nfactotum: mschap fix

2012-03-30 Thread Yaroslav
Forwarding it to the list so people don't bother to debug themselves.
It's tested with cifs and a local change which enables upas/fs to do
IMAP with NTLM auth.

-- Forwarded message --
From: Yaroslav yari...@gmail.com
Date: 2012/3/30
Subject: Re: [9fans] SSHv2
To: erik quanstrom quans...@quanstro.net


2012/3/30 erik quanstrom quans...@quanstro.net:
 On Fri Mar 30 09:48:50 EDT 2012, yari...@gmail.com wrote:
 2012/3/30 erik quanstrom quans...@quanstro.net:
  what's the basis for this claim?  it might be broken, since we don't use it
  much, but it's not missing.

 Yes, sorry, I've meant it's broken; details follow.

 try pulling a new copy.

 - erik

There are phases mismatch between factotum's chapconv() and libauth's
auth_respond(). I've checked plan9port - it has identical problem.
Patch which fixes it follows:

term% diff -c /n/sources/contrib/quanstro/root/sys/src/cmd/auth/factotum/chap.c
/sys/src/cmd/auth/factotum/chap.c
/n/sources/contrib/quanstro/root/sys/src/cmd/auth/factotum/chap.c:120,125
- /sys/src/cmd/auth/factotum/chap.c:120,126

       ret = -1;
       chal = nil;
+       res = nil;
       k = nil;
       attr = c-attr;

/n/sources/contrib/quanstro/root/sys/src/cmd/auth/factotum/chap.c:153,166
- /sys/src/cmd/auth/factotum/chap.c:154,163
       c-state = read challenge;
       if((nchal = convreadm(c, (char**)(void*)chal))  0)
               goto out;
-       if(astype == AuthMSchap  nchal != MSchallen)
-       c-state = write user;
       if((user = strfindattr(k-attr, user)) == nil){
               werrstr(key has no user (cannot happen?));
               goto out;
       }
-       if(convprint(c, %s, user)  0)
-               goto out;

       c-state = write response;
       if((pw = strfindattr(k-privattr, !password)) == nil){


-- 
- Yaroslav



Re: [9fans] rc: fn name @{block}

2012-03-30 Thread Yaroslav
 you've misunderstood the current grammar.  you have defined 2 functions
 name and '@' as {block}.  the binding, illustrated with parens is
        fn (name @) {block}
 the production in the grammer is
        FN words brace
 but since once production for words is words - keyword, a keyword
 is a valid function name.

Then, how would you explain this:

term% fn x @{x=y}
term% whatis x
fn x {x=y}
term% fn 'x @'{x=y}
term% whatis 'x @'
fn 'x @' {x=y}



Re: [9fans] rc: fn name @{block}

2012-03-30 Thread Yaroslav
 term% fn x @{x=y}
 term% whatis x
 fn x {x=y}

 creates to functions x and '@' definition {x=y}.

The question is why it discards @ here?



Re: [9fans] nfactotum: mschap fix

2012-03-30 Thread yaroslav
 surely you need to use the user attribute.  if you don't please send
 a copy of chap that doesn't give compiler warnings.

The user attribute is available at the end of CR protocol, upon 'attr'
rpc request.

The attached chap.c compiles cleanly here.

- yk
/*
 * CHAP, MSCHAP
 * 
 * The client does not authenticate the server, hence no CAI
 *
 * Protocol:
 *
 *  S - C: random 8-byte challenge
 *  C - S: user in UTF-8
 *  C - S: Chapreply or MSchapreply structure
 *  S - C: ok or 'bad why'
 *
 * The chap protocol requires the client to give it id=%d, the id of
 * the PPP message containing the challenge, which is used
 * as part of the response.  Because the client protocol is message-id
 * specific, there is no point in looping to try multiple keys.
 *
 * The MS chap protocol actually uses two different hashes, an
 * older insecure one called the LM (Lan Manager) hash, and a newer
 * more secure one called the NT hash.  By default we send back only
 * the NT hash, because the LM hash can help an eavesdropper run
 * a brute force attack.  If the key has an lm attribute, then we send only the
 * LM hash.
 */

#include std.h
#include dat.h

extern Proto chap, mschap;

enum {
ChapChallen = 8,

MShashlen = 16,
MSchallen = 8,
MSresplen = 24
};

static int
chapcheck(Key *k)
{
if(!strfindattr(k-attr, user) || !strfindattr(k-privattr, 
!password)){
werrstr(need user and !password attributes);
return -1;
}
return 0;
}

static void
nthash(uchar hash[MShashlen], char *passwd)
{
uchar buf[512];
int i;

for(i=0; *passwd  isizeof(buf); passwd++) {
buf[i++] = *passwd;
buf[i++] = 0;
}

memset(hash, 0, 16);

md4(buf, i, hash, 0);
}

static void
desencrypt(uchar data[8], uchar key[7])
{
ulong ekey[32];

key_setup(key, ekey);
block_cipher(ekey, data, 0);
}

static void
lmhash(uchar hash[MShashlen], char *passwd)
{
uchar buf[14];
char *stdtext = KGS!@#$%;
int i;

strncpy((char*)buf, passwd, sizeof(buf));
for(i=0; isizeof(buf); i++)
if(buf[i] = 'a'  buf[i] = 'z')
buf[i] += 'A' - 'a';

memset(hash, 0, 16);
memcpy(hash, stdtext, 8);
memcpy(hash+8, stdtext, 8);

desencrypt(hash, buf);
desencrypt(hash+8, buf+7);
}

static void
mschalresp(uchar resp[MSresplen], uchar hash[MShashlen], uchar chal[MSchallen])
{
int i;
uchar buf[21];

memset(buf, 0, sizeof(buf));
memcpy(buf, hash, MShashlen);

for(i=0; i3; i++) {
memmove(resp+i*MSchallen, chal, MSchallen);
desencrypt(resp+i*MSchallen, buf+i*7);
}
}

static int
chapclient(Conv *c)
{
int id, astype, nchal, npw, ret;
uchar *chal;
char *s, *pw, *res;
Attr *attr;
Key *k;
Chapreply cr;
MSchapreply mscr;
DigestState *ds;

ret = -1;
chal = nil;
res = nil;
k = nil;
attr = c-attr;

if(c-proto == chap){
astype = AuthChap;
s = strfindattr(attr, id);
if(s == nil || *s == 0){
werrstr(need id=n attr in start message);
goto out;
}
id = strtol(s, s, 10);
if(*s != 0 || id  0 || id = 256){
werrstr(bad id=n attr in start message);
goto out;
}
cr.id = id;
}else if(c-proto == mschap)
astype = AuthMSchap;
else{
werrstr(bad proto);
goto out;
}

c-state = find key;
k = keyfetch(c, %A %s, attr, c-proto-keyprompt);
if(k == nil)
goto out;

c-attr = addattrs(copyattr(attr), k-attr);

c-state = read challenge;
if((nchal = convreadm(c, (char**)(void*)chal))  0)
goto out;
if(strfindattr(k-attr, user) == nil){
werrstr(key has no user (cannot happen?));
goto out;
}

c-state = write response;
if((pw = strfindattr(k-privattr, !password)) == nil){
werrstr(key has no password (cannot happen?));
goto out;
}
npw = strlen(pw);

if(astype == AuthChap){
ds = md5(cr.id, 1, 0, 0);
md5((uchar*)pw, npw, 0, ds);
md5(chal, nchal, (uchar*)cr.resp, ds);
if(convwrite(c, cr, sizeof cr)  0)
goto out;
}else{
uchar hash[MShashlen];

memset(mscr, 0, sizeof mscr);
if(strfindattr(k-attr, lm)){
lmhash(hash, pw);
mschalresp((uchar*)mscr.LMresp, 

Re: [9fans] rc: fn name @{block}

2012-03-30 Thread Yaroslav
I see now. Thank you guys!

 Erik's point is that rc isn't discarding it. You have a list. It sets x
 equal to that function, then sets @ equal to that same function.

 : iota; fn x @{x=y}
 : iota; whatis x
 fn x {x=y}
 : iota; whatis '@'
 fn @ {x=y}



Re: [9fans] Regarding 9p based protocols message framing

2012-03-21 Thread Yaroslav
 Perhaps initially: over an IP network, 9P used to run over IL.

 still does, including on the system i'm sending this from.


What advantages does it have over TCP? Does it worths the effort of
tailoring it back in, esp. for a fossil/venti site?

-- 
- Yaroslav



Re: [9fans] Regarding 9p based protocols message framing

2012-03-20 Thread Yaroslav
  Why was I puzzled: because as a non Plan9 user / developer, I
 usually think of the underlaying transport technology (be it sockets
 or 9p) as a stream of bytes without explicit framing.

As I understand, 9P itself is designed to operate on top of a
message-oriented transport; however, it has everything required to run
over a stream, esp. message length at beginning of every message.
Framing is done by the library: the read9pmsg routine performs as many
reads as necessary to return a complete 9P message to the caller.



Re: [9fans] Question about usage of Plan 9 based os systems

2012-03-15 Thread Yaroslav
some of us.
-- 
- Yaroslav



Re: [9fans] Mercurial and Plan 9

2012-03-14 Thread Yaroslav
Speaking of which... what would be the trick to make libsec visible
for an APE source?
-- 
- Yaroslav



Re: [9fans] GSoC application ideas page

2012-03-13 Thread Yaroslav
I'd suggest to complete native SSH2 implementation.

2012/3/13 Peter A. Cejchan tyap...@gmail.com:
 It would be nice to have a widget library including buttons, drop-down 
 menus, multiple-line text entry, radio buttons, scrollbars, etc.

 Oh, no!!!
 ++pac




-- 
- Yaroslav



Re: [9fans] pxeboot tftpd

2012-03-13 Thread Yaroslav
Yes, tftpd becomes none and calls newns(2), thus the only way to have
/net.alt populated for it is through /lib/namespace, as you figured
out.
-- 
- Yaroslav



Re: [9fans] fossil pb: FOUND!

2012-01-13 Thread Yaroslav
please note that the sum du returns may be bigger than the actual
storage used anyway - think deduping and compression done at venti
level.



Re: [9fans] miau, an IRC bouncer

2012-01-13 Thread Yaroslav
well, there is a session persistense in Plan 9, and its name is vncs(1)…



Re: [9fans] Plan 9/plan9port coding conventions

2012-01-12 Thread Yaroslav
 style(6) deals with some of your questions.

Since nobody mentioned it yet,

Besides style(6) you may want to read Notes on Programming in C, Rob
Pike, 1989.



Re: [9fans] miau, an IRC bouncer

2012-01-12 Thread Yaroslav
2012/1/12 John Floren j...@jfloren.net:
 but I missed the simplicity and
 convenience of having just one nickname on IRC at all times

why not to use their nickserv extentions for this purpose,
and a startup script to deal with connection and authentication to
select servers and channels?



Re: [9fans] venti and contrib: RFC

2012-01-05 Thread Yaroslav
2012/1/5 Bakul Shah ba...@bitblocks.com:
 You'd save a bunch of energy if you only powered up venti
 disks once @ 4AM for a few minutes (and on demand when you
 look at /n/dump).  Though venti might have fits! And the disks
 might too! So may be this calls for a two level venti? First
 to an SSD RAID and a much less frequent venti/copy to hard
 disks.

I think you're confusing kenfs+worm with fossil+venti in sense that
ken fs is a complete cache for worm while fossil is a write cache for
venti. You need venti running all the time.

-- 
- Yaroslav



Re: [9fans] a 9P session between debian client and Plan 9 server side

2012-01-03 Thread Yaroslav
2012/1/3 Kin Loo kinloo1...@gmail.com:
   longy# aux/listen1 -tv tcp!*!1114 /bin/exportfs -S /srv/memfs 

Try exportfs -d and check /tmp/exportdb for hints.



Re: [9fans] ssh-agent

2011-12-27 Thread Yaroslav
It only works with the new factotum, doesn't it?

2011/12/20 Steve Simon st...@quintile.net:
 I ported Russ's ssh agent to plan9 for use with
 the native, and linuxemu openssh implementations.

 The program is a protocol converter parsing requests
 from openssh and extracting the keys from factotum
 as requited.

 Code in /n/sources/contrib/steve/ssh-agent.tgz

 -Steve


-- 
- Yaroslav



Re: [9fans] RAID box with plan9 filesystem

2011-12-26 Thread Yaroslav
2011/12/25 Aram Hăvărneanu ara...@mgk.ro:
 My experience with fossil has been somewhere between the two,
 but it's very easy to recover if you're using it with venti.

 What does this recovery mean?  Does fossil need to be repopulated, an
 O(n) operation, or does it act merely as a cache that gets cold? (an
 O(1) operation).

Fossil is a write cache for venti - the blocks in the archival
snapshots are moved to Venti. Read requests are proxied for venti.
Recovery means initializing the filesystem using the given vac scrore,
with no implied data transfer - blocks are copied-on-write.

-- 
- Yaroslav



Re: [9fans] fun with replica and pull

2011-12-20 Thread Yaroslav
Replica(8) is bad at overlaying several sources...
Perhaps contrib(1) should hide this somehow.



Re: [9fans] 9vx instability

2011-11-24 Thread Yaroslav
2011/11/22 Skip Tavakkolian skip.tavakkol...@gmail.com:
 because 9fans not only agree to disagree, they also disagree to agree :)

+1



Re: [9fans] native (mostly) go for plan9

2011-11-01 Thread Yaroslav
2011/10/31 ron minnich rminn...@gmail.com:
 you forgot to
 cd /go/src
 . 9setup

why not to have what's in 9setup directly in 9.mk?



[9fans] p9any auth in u9fs: uid value in ticked is ignored

2011-10-10 Thread Yaroslav
There is a security problem with p9auth in u9fs: it uses uname from
Tauth/Tattach as user's identity - ignoring the user id which has been
authenticated to the auth server.  As uname is always set to up-user
in devmnt, this means that:

a) a user cann't have a different name on the u9fs machine; and, more
serious,

b) a user can easily masquerade as another user to u9fs by simply
booting his terminal under that user while using own credentials for
optaining the ticket.

A proposed fix has been submitted as /n/sources/patch/u9fs-p9sk1:

/n/dump/2011/1010/sys/src/cmd/unix/u9fs/authp9any.c:369,375 -
/sys/src/cmd/unix/u9fs/authp9any.c:369,378
fprint(2, p9anyattach: afid %d state %d\n, rx-afid, 
sp-state);
if (sp-state == Established  strcmp(rx-uname, sp-uname) == 0
 strcmp(rx-aname, sp-aname) == 0)
+   {
+   rx-uname = sp-t.suid;
return nil;
+   }
return authentication failed;
  }

Whether to use t.suid or t.cuid as the target uid remains an open
question: authsrv(6) says t.suid represents target uid; the real use,
howerver, is not that clear: cwfs for 9p2k uses t.suid; while fossil,
exportfs, cpu -R and cwfs for old9p check against t.cuid.  Comments in
/sys/include/authsrv.h:58,76 appear somewhat opaque until authsrv(6)
and p9sk1 client/server code in factotum are carefully studied.

- Yaroslav

─
Related matter:
/sys/src/9/port/devmnt.c:281
/sys/src/9/port/devmnt.c:347
/sys/src/cmd/auth/factotum/p9sk1.c:170,171
/sys/src/cmd/auth/factotum/rpc.c:341
/sys/src/libauth/auth_chuid.c:37
/sys/src/cmd/unix/u9fs/authp9any.c:370
/sys/src/cmd/unix/u9fs/u9fs.c:417,420
/sys/src/cmd/cpu.c:665
/sys/src/cmd/fossil/9auth.c:30,38
/sys/src/cmd/fossil/9auth.c:132,151
/sys/src/cmd/fossil/9auth.c:155
/sys/src/cmd/fossil/9p.c:999,1007
/sys/src/cmd/cwfs/9p1.c:134,138
/sys/src/cmd/cwfs/9p2.c:252,262
/sys/src/cmd/cwfs/auth.c:313
/sys/src/cmd/cwfs/auth.c:291
/sys/src/cmd/exportfs/exportfs.c:189,192



Re: [9fans] p9any auth in u9fs: uid value in ticked is ignored

2011-10-10 Thread Yaroslav
devmnt always uses up-user for Tauth/Tattach no matter what an auth
protocol would yield (/sys/src/9/port/devmnt.c:281). Stock 9P servers
tolerate this and check Tattach.uname to match Tauth.uname but use
t.cuid or t.suid as the true user identity (unless no auth required).

Anyway, simply trusting Tattach.uname is too naïve - at least for p9any.

 It's true that the server must take account of the result of
 authentication, but although that might not
 mean identity, the results of authentication should be consistent with
 the name presented as uname
 in Tauth/Tattach. In the context of p9auth I think that means that the
 cuid of AuthInfo should match.



Re: [9fans] p9any auth in u9fs: uid value in ticked is ignored

2011-10-10 Thread Yaroslav
Uname in Tauth/Tattach indeed seem to be irrelevant for p9any but as
it is external to 9P this may be a provision for other possible auth
schemes where the uname may be the only place to provide an indentity
being authenticated...



Re: [9fans] namec() dislikes #M - why?

2011-10-04 Thread Yaroslav
Perhaps, Steve wants rio-simulated /dev/cons.
Steve, doesn't mount -b $wsys /dev in the new ns do the trick?

2011/10/4 Charles Forsyth charles.fors...@gmail.com:
 #M, but devcons? devcons is #c

 On 4 October 2011 14:34, Steve Simon st...@quintile.net wrote:

 then build a new one including some bits of devcons.

  ...

 Also, why is this done here and not in fsattach() of devcons
 (with a refcount)?



-- 
- Yaroslav



Re: [9fans] reverse search direction in p9p acme

2011-09-23 Thread Yaroslav
 rio doesn't have button 3 search. acme does.

been missing a search in rio few times...



Re: [9fans] interesting(?) widgets idea

2011-07-14 Thread Yaroslav
do we really need screens? lets move everything into our imagination.
all we need is to get a draw(3) interface to it...



[9fans] 9fans archive engine

2011-07-14 Thread Yaroslav
Is the software which powers 9fans web archive publicly available?



Re: [9fans] novel userspace paradigms introduced by plan 9

2011-07-04 Thread Yaroslav
one might find http://www.glendix.org/ project interesting

2011/7/2 Robert Seaton seat...@dupage.edu:
 Hello, 9fans!
 ...



Re: [9fans] auth change? / auth for u9fs on a mac

2011-07-04 Thread Yaroslav
 I am pretty sure this has worked for several years but now it is broken:

Has mac-owner's key been expired in your auth keyfs?

Are you all happy to sprinkle bootes key onto unix machines (hard to believe)?

negative: the credentials you put in /etc/u9fs.key represent the
service, not a client. A client may be any valid user registered in
the AS. U9fs uses its key to decrypt tickets issued by the AS to
clients.



Re: [9fans] how to unlock screenlock?

2011-06-30 Thread Yaroslav
check output of
% grep 'proto=p9sk1' /mnt/factotum/ctl

make sure the right key is on top of the list.

2011/6/29 Nicolas Bercher nberc...@yahoo.fr:
 Hi,

 I read the man page saying how to unlock the screenshot.  But for sure
 typing the password and then enter didn't work for me.  Moreover, it is a
 little disappointing that nothing either move or changes on the screen while
 I'm typing, so I don't even know if my typing actually works!

 So, what's the trick with this screenlock?

 Thank you,
 Nicolas.





-- 
- Yaroslav



Re: [9fans] RFS alternatives (Was: Living with Plan 9)

2011-06-30 Thread Yaroslav
 also, the `protocol' of creating new /dev/pts/* is somewhat sensible, too. no
 ioctl(), just open /dev/pmtx, read a textual representation of an integer N
 and open /dev/pts/N.

nah, slave name is obtained with ptsname(master) which does
ioctl(TIOCGPTN) on Linux.

...
open(/dev/ptmx, O_RDWR|O_NOCTTY)  = 3
statfs(/dev/pts, {f_type=DEVPTS_SUPER_MAGIC, f_bsize=4096,
f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0,
0}, f_namelen=255, f_frsize=4096}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(3, TIOCGPTN, [8]) = 0
stat64(/dev/pts/8, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 8), ...}) = 0
...

AIX does too:
...
kopen(/dev/ptc, O_RDWR|O_NOCTTY)  = 3
__loadx(0x01480180, 0x2FF21B50, 0x0A50, 0xF06AFBB4, 0x) = 0xF0FE4A28
_kgrantpt(0x0003, 0x0001, 0xF065F3F8, 0xD032, 0x0003,
0x0350, 0x, 0x) = 0x
kioctl(3, 536900678, 0x2FF22670, 0x)= 0
kioctl(3, 536900679, 0x2FF225F0, 0x)= 0
kioctl(3, 22529, 0x2FF221B4, 0x)= 0
statx(/dev/pts/27, 0x2FF221D8, 76, 0) = 0
...



Re: [9fans] nupas contrib needs rebuilding

2011-06-02 Thread Yaroslav
contrib(1) should have a way to pass -s to replica/pull



Re: [9fans] nupas contrib needs rebuilding

2011-06-02 Thread Yaroslav
apparently contrib/install needs too...

2011/6/2 Federico G. Benavento benave...@gmail.com:
 contrib/pull does




-- 
- Yaroslav



Re: [9fans] exportfs / u9fs / v9fs / npfs / spfs versus 9vx

2011-05-16 Thread Yaroslav
 Have you had trouble getting to u9fs from 9vx?

Works for me: I use it with over SSH1 channel to mount AIX and Linux files.
Excerpt from /rc/bin/9fs:

case $aixsystems
srvssh -r -u bin/AIX/u9fs $1 $1.$user /n/$1
chmod 600 /srv/$1.$user
case $linuxsystems
srvssh -r -u bin/Linux/u9fs $1 $1.$user /n/$1
chmod 600 /srv/$1.$user



Re: [9fans] contrib(1) WAS: Re: wiki...

2011-04-24 Thread Yaroslav
Doesn't contrib/pull complete an unfinished installation?

2011/4/24  smi...@zenzebra.mv.com:
 erik quanstrom quans...@quanstro.net writes:

 IIRC it's based on replica(1)
 which rather requires ideal circumstances for correct behaviour.

 partial installs are easy to recover from.  i just used it friday to sort
 out a file system that had a contrib package listed as installed, but it
 hadn't been.

 It *would* be easy if contrib(1) properly indicated the install status
 of a package.  As it is right now, contrib/install marks a package as
 installed and THEN goes about installing it.  If anything fails, the
 install will still be marked as having been successful.  A subsequent
 contrib/install for the same package will snubly claim that the package
 has already been installed and refuse to run.  You have to supply the
 '-f' switch to make the install complete.  However, doing this requires
 (1) knowing that the install broke, and (2) that all the packages
 dependencies have been met (because -f also overrides dependency
 checking).  contrib(1) doesn't provide any way to check if a package is
 up to date, like replica/changes.  Having a contrib(1) wrapper for
 replica/changes (say, 'contrib/changes') would be very handy.  (And
 simple to write.)

 As for prematurely marking packages as successfully installed...

 This:

    cat  $cfg !
    ...
    exec /bin/contrib/pull $name

 should probably be replaced with something like:

    cat  $cfg.part !
    ...
    /bin/contrib/pull $name
    if(~ -$status -) mv $cfg.part $cfg
    if not {
        echo install failed [1=2]
        rm $cfg.part
        exit 'oh, crap'
    }

 --
 +---+
 |E-Mail: smi...@zenzebra.mv.com             PGP key ID: BC549F8B|
 |Fingerprint: 9329 DB4A 30F5 6EDA D2BA  3489 DAB7 555A BC54 9F8B|
 +---+





-- 
- Yaroslav



  1   2   >