[OpenAFS-devel] Alternate cell PAM patch

Charles Clancy security@xauth.net
Tue, 25 Jun 2002 10:20:49 -0500 (CDT)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-851401618-1025018449=:28011
Content-Type: TEXT/PLAIN; charset=US-ASCII

Attached is a patch against the 1.2.5 source that will let you do
something like:

auth optional   /lib/security/pam_afs.so cell other-cell.domain.net
auth sufficient /lib/security/pam_afs.so try_first_pass refresh_token \
	cell main-cell.domain.net
auth required   /lib/security/pam_unix.so

You need to specify "refresh_token" the second time you call it to prevent
it from getting a second PAG and making your first token useless.

Or, you can just use it once to authenticate to a cell other than what's
in /usr/vice/etc/ThisCell.  Not specifying the "cell" argument causes the
expected behavior of authenticating against the local cell.

[  t charles clancy  ]-[  tclancy@uiuc.edu  ]-[  uiuc.edu/~tclancy  ]
[  crypto  ][  coordinated science lab  ][  university of illinois  ]

---559023410-851401618-1025018449=:28011
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="multi-cell-pam.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.4.44.0206251020490.28011@ismene>
Content-Description: 
Content-Disposition: attachment; filename="multi-cell-pam.patch"

LS0tIHNyYy9wYW0vYWZzX2F1dGguYwlXZWQgRGVjIDI2IDE0OjIzOjAzIDIw
MDENCisrKyBzcmMvcGFtL2Fmc19hdXRoLmMJVHVlIEp1biAyNSAwOTo0Nzoy
MCAyMDAyDQpAQCAtNDcsNiArNDcsNyBAQA0KICAgICBpbnQgaWdub3JlX3Vp
ZCAgPSAwOw0KICAgICB1aWRfdCBpZ25vcmVfdWlkX2lkID0gMDsNCiAgICAg
Y2hhciBteV9wYXNzd29yZF9idWZbMjU2XTsNCisgICAgY2hhciBjZWxsX25h
bWVbMjU2XTsNCiAgICAgLyoNCiAgICAgICogdGhlc2Ugb3B0aW9ucyBhcmUg
YWRkZWQgdG8gaGFuZGxlIHN0dXBpZCB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RUQgKSB7DQogCSAgICBpZiAodXNlX2tsb2cpIHsNCi0gICAgICAgICAgICAg
ICBhdXRoX29rID0gISBkb19rbG9nKHVzZXIsIHBhc3N3b3JkLCAiMDA6MDA6
MDEiKTsNCisgICAgICAgICAgICAgICBhdXRoX29rID0gISBkb19rbG9nKHVz
ZXIsIHBhc3N3b3JkLCAiMDA6MDA6MDEiLCBjZWxsX25hbWUpOw0KIAkgICAg
ICAga3RjX0ZvcmdldEFsbFRva2VucygpOw0KIAkgICAgfSBlbHNlIHsNCiAg
ICAgICAgICAgICBpZiAoIGthX1ZlcmlmeVVzZXJQYXNzd29yZCgNCiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICBLQV9VU0VSQVVUSF9WRVJTSU9OLA0K
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXIsIC8qIGtlcmJlcm9z
IG5hbWUgKi8NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY2hhciAq
KTAsIC8qIGluc3RhbmNlICovDQotICAgICAgICAgICAgICAgICAgICAgICAg
ICAgKGNoYXIgKikwLCAvKiByZWFsbSAqLw0KKyAgICAgICAgICAgICAgICAg
ICAgICAgICAgIGNlbGxfbmFtZSwgLyogcmVhbG0gKi8NCiAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgcGFzc3dvcmQsIC8qIHBhc3N3b3JkICovDQog
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIC8qIHNwYXJlIDIgKi8N
CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnJlYXNvbiAvKiBlcnJv
ciBzdHJpbmcgKi8NCkBAIC0yODksMTMgKzI5OCwxMyBAQA0KIAl9DQogCSAg
ICANCiAJaWYgKCAgZmxhZ3MgJiBQQU1fRVNUQUJMSVNIX0NSRUQgKSB7DQot
CSAgIGlmICh1c2Vfa2xvZykgYXV0aF9vayA9ICEgZG9fa2xvZyh1c2VyLCBw
YXNzd29yZCwgTlVMTCk7DQorCSAgIGlmICh1c2Vfa2xvZykgYXV0aF9vayA9
ICEgZG9fa2xvZyh1c2VyLCBwYXNzd29yZCwgTlVMTCwgY2VsbF9uYW1lKTsN
CiAJICAgZWxzZSB7DQogCSAgICBpZiAoIGthX1VzZXJBdXRoZW50aWNhdGVH
ZW5lcmFsKA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtBX1VTRVJB
VVRIX1ZFUlNJT04sDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNl
ciwgLyoga2VyYmVyb3MgbmFtZSAqLw0KICAgICAgICAgICAgICAgICAgICAg
ICAgICAgIChjaGFyICopMCwgLyogaW5zdGFuY2UgKi8NCi0gICAgICAgICAg
ICAgICAgICAgICAgICAgICAoY2hhciAqKTAsIC8qIHJlYWxtICovDQorICAg
ICAgICAgICAgICAgICAgICAgICAgICAgY2VsbF9uYW1lLCAvKiByZWFsbSAq
Lw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXNzd29yZCwgLyog
cGFzc3dvcmQgKi8NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwg
LyogZGVmYXVsdCBsaWZldGltZSAqLw0KICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAmcGFzc3dvcmRfZXhwaXJlcywNCi0tLSBzcmMvcGFtL2Fmc191
dGlsLmMJU3VuIEphbiAyMCAwMjozNDo0NCAyMDAyDQorKysgc3JjL3BhbS9h
ZnNfdXRpbC5jCVR1ZSBKdW4gMjUgMDk6NDc6MjEgMjAwMg0KQEAgLTkxLDcg
KzkxLDcgQEANCiAgICAgcmV0dXJuIHRwOw0KIH0NCiANCi1pbnQgZG9fa2xv
Zyhjb25zdCBjaGFyKiB1c2VyLCBjb25zdCBjaGFyKiBwYXNzd29yZCwgY29u
c3QgY2hhciogbGlmZXRpbWUpDQoraW50IGRvX2tsb2coY29uc3QgY2hhciog
dXNlciwgY29uc3QgY2hhciogcGFzc3dvcmQsIGNvbnN0IGNoYXIqIGxpZmV0
aW1lLCBjb25zdCBjaGFyKiBjZWxsX25hbWUpDQogew0KIHBpZF90CXBpZDsN
CiBpbnQJcGlwZWRlc1syXTsNCkBAIC0xMTcsNiArMTE3LDEwIEBADQogICAg
YXJndlthcmdjKytdID0gImtsb2ciOw0KICNlbmRpZg0KICAgIGFyZ3ZbYXJn
YysrXSA9IChjaGFyKil1c2VyOw0KKyAgIGlmIChjZWxsX25hbWVbMF0gIT0g
MCkgew0KKyAgICAgIGFyZ3ZbYXJnYysrXSA9ICItY2VsbCI7DQorICAgICAg
YXJndlthcmdjKytdID0gKGNoYXIqKWNlbGxfbmFtZTsNCisgICB9DQogICAg
YXJndlthcmdjKytdID0gIi1zaWxlbnQiOw0KICAgIGFyZ3ZbYXJnYysrXSA9
ICItcGlwZSI7DQogICAgaWYgKGxpZmV0aW1lICE9IE5VTEwpIHsNCg==
---559023410-851401618-1025018449=:28011--