Netapp sue Sun

This is fun, theses two CEO of theses big companies are dog fighting each others :

Dave post:

http://blogs.netapp.com/dave/2007/09/netapp-sues-sun.html

Johanthan answer:

http://blogs.sun.com/jonathan/entry/on_patent_trolling

but the real (fake) truth about that post is here :

http://fakeschwartz.blogspot.com/2007/09/bring-it-cowboy.html

I tend to believe more NetAPP in this case, just because i don’t know how many time i have sweared on that bloody ps -aux that does not work on solaris.

Generating md5 encrypted password for chpasswd

If you want to generate properly encrypted password to feed to chpasswd, the most easier and proper way is to do that from command line :
[code lang=”bash”]
echo "encryptedpassword"|openssl passwd -1 -stdin
[/code]
If you want to generate in pure python you can do it like that :
[code lang=”python”]
def md5crypt(password, salt, magic=’$1$’):
import md5
m = md5.new()
m.update(password + magic + salt)

# /* Then just as many characters of the MD5(pw,salt,pw) */
mixin = md5.md5(password + salt + password).digest()
for i in range(0, len(password)):
m.update(mixin[i % 16])

# /* Then something really weird… */
# Also really broken, as far as I can tell. -m
i = len(password)
while i:
if i & 1:
m.update(‘x00’)
else:
m.update(password[0])
i >>= 1

final = m.digest()
# /* and now, just to make sure things don’t run too fast */
for i in range(1000):
m2 = md5.md5()
if i & 1:
m2.update(password)
else:
m2.update(final)
if i % 3:
m2.update(salt)
if i % 7:
m2.update(password)

if i & 1:
m2.update(final)
else:
m2.update(password)

final = m2.digest()

# This is the bit that uses to64() in the original code.
itoa64 = ‘./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’
rearranged = ”
for a, b, c in ((0, 6, 12), (1, 7, 13), (2, 8, 14), (3, 9, 15), (4, 10, 5)):
v = ord(final[a]) < < 16 | ord(final[b]) << 8 | ord(final[c]) for i in range(4): rearranged += itoa64[v & 0x3f]; v >>= 6

v = ord(final[11])
for i in range(2):
rearranged += itoa64[v & 0x3f]; v >>= 6

return magic + salt + ‘$’ + rearranged

[/code]

You need to feed it up with a salt, like this :
[code lang=”python”]
def generate_salt(count):
import random, string
char = string.ascii_letters + string.digits + string.punctuation.replace(‘:’, ”)
return string.join(map(lambda x,v=char: random.choice(v), range(count)), ”)
[/code]

Mixing 64 bytes and 32 Bytes Libraries on Solaris

Remind to myself to use the switch -64 on solaris with crle to tell
the linker on solaris to get the linker ‘seeing’ 64 libraries.

I wonder why everything is not as simple as linux thought where we
have everything in one place with /etc/ld.so.config