[patch] New-applet howto. (and new applet)
Tito
farmatito at tiscali.it
Wed May 9 02:33:03 PDT 2007
On Wednesday 09 May 2007 01:25:21 Denis Vlasenko wrote:
> On Tuesday 08 May 2007 22:22, Tito wrote:
> > On Tuesday 08 May 2007 21:32:28 Tito wrote:
> > > On Tuesday 08 May 2007 19:52:31 Denis Vlasenko wrote:
> > > > On Tuesday 08 May 2007 15:15, Thomas Lundquist wrote:
> > > > > On Tue, May 08, 2007 at 12:39:55AM +0200, Denis Vlasenko wrote:
> > > > > >
> > > > > > string is optional, thus should be [string].
> > > > > > "This also takes stdin as password\n" - what does this exactly mean?
> > > > >
> > > > > Just wanted to describe that you can do
> > > > >
> > > > > BAR='echo "foo" | ./ cryptpw'
> > > > >
> > > > > somehow.
> > > > >
> > > > > but it's still a unix applet so it's supposed to do that anyway.
> > > > >
> > > > > Just remove the line I guess.
> > > > >
> > > > > tested your patch and it's working and a nice lession in cutting.
> > > > >
> > > > > Your patch, with a line less in usage.h attached.
> > > >
> > > > Applied, thanks!
> > > > --
> > > > vda
> > > Hi,
> > > Denis, maybe you forgot to svn add cryptpw.c ?
> >
> > and libbb/crypt_make_salt.c !!!
>
> Oh my.
>
> > > Ciao,
> > > Tito
> >
> > BTW:
> >
> > scripts/bloat-o-meter busybox_old busybox_unstripped
> > function old new delta
> > cryptpw_main 207 164 -43
> > ------------------------------------------------------------------------------
> > (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-43) Total: -43 bytes
> >
> >
> > int cryptpw_main(int argc, char **argv)
> > {
> > char salt[11] = "$1$\0\0\0\0\0\0\0\0";
> >
> > getopt32(argc, argv, "a:", NULL);
> >
> > crypt_make_salt(salt + 3, 4); /* md5 */
> > if (argc > 2 && argv[2][0] == 'd') /* des */
> > crypt_make_salt(salt, 1);
> >
> > puts(pw_encrypt(argv[argc - 1] ? argv[argc - 1] : xmalloc_getline(stdin), salt));
> >
> > return 0;
> > }
>
> I will look at it later today. 01:25 on the clock 8]
> --
> vda
>
Hi, better look at this version as the previous is bugged ;-)
scripts/bloat-o-meter busybox_old busybox_unstripped
function old new delta
cryptpw_main 207 145 -62
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-62) Total: -62 bytes
BTW: there is a little memory leak when reading from stdin...
Ciao,
Tito
-------------------------------------------------------------------------------------------------------
/* vi: set sw=4 ts=4: */
/*
* cryptpw.c
*
* Cooked from passwd.c by Thomas Lundquist <thomasez at zelow.no>
*
*/
#include "busybox.h"
int cryptpw_main(int argc, char **argv)ATTRIBUTE_NORETURN;
int cryptpw_main(int argc, char **argv)
{
char salt[11] = "$1$\0\0\0\0\0\0\0\0";
if (getopt32(argc, argv, "a:", NULL) && *argv[optind - 1] == 'd')
crypt_make_salt(salt, 1); /* des */
else
crypt_make_salt(salt + 3, 4); /* md5 */
puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_getline(stdin), salt));
exit(EXIT_SUCCESS);
}
-----------------------------------------------------------------------------------------------------------
More information about the busybox
mailing list