Derek Wright <[email protected]> wrote on 2010/09/30 16:43:17: > > On Thu, Sep 30, 2010 at 10:37 AM, Joakim Tjernlund > <[email protected]> wrote: > > Derek Wright <[email protected]> wrote on 2010/09/30 16:33:18: > >> > >> On Thu, Sep 30, 2010 at 10:19 AM, Joakim Tjernlund > >> <[email protected]> wrote: > >> > Derek Wright <[email protected]> wrote on 2010/09/30 16:11:57: > >> >> > >> >> On Thu, Sep 30, 2010 at 9:45 AM, Joakim Tjernlund > >> >> <[email protected]> wrote: > >> >> > Derek Wright <[email protected]> wrote on 2010/09/30 15:27:06: > >> >> >> > >> >> >> Hello all, I'm attempting to write a very small program that > >> >> >> utilizes the > >> >> >> bacula hmac and bin_to_base64 functions so I can auth to my director > >> >> >> as a > >> >> >> console. It seems that my output is slightly different than what the > >> >> >> director > >> >> >> computes for a base64 hash, example: > >> >> >> > >> >> >> Director expects: p6+IvREdwWdjZ8kPkQ+cUC > >> >> >> But the program I wrote gives: p6+IvREdwWdjZ8kPkQ+cU > >> >> > > >> >> > Could it be that Director expects an newline in the end? > >> >> > > >> >> > Jocke > >> >> > > >> >> > > >> >> But that ascii "C" is created in the encoding process from the 16bit > >> >> hmac-md5 hash (i think? :P ). When I take the text output from my > >> >> program and send it to the director it is terminated with a newline > >> >> character. Basically im executing this little program w/ PHP exec() > >> >> and sending the generated base64 to my director via a socket so I can > >> >> build a webapp to auth/manage all of my Bacula directors. > >> > > >> > Add en newline to the passwd before you hash it? > >> > > >> > > >> > >> That didnt seem to work, here is the new code: > >> > >> #include "bacula.h" > >> > >> char* chal; > >> char* password; > >> uint8_t hmac[20]; > >> char base64[23]; > >> uint8_t i; > >> char* newline; > >> > >> int main(int argc, char *argv[]) > >> { > >> chal = argv[1]; > >> newline = "\n"; > >> password = argv[2]; > >> strcat(password, newline); > >> hmac_md5((uint8_t *)chal, 50, (uint8_t *)password, > >> strlen(password), hmac); > >> bin_to_base64(base64, sizeof(base64), (char *)hmac, 16, false) + 1; > >> printf("%s\n", base64); > >> } > >> > >> labsrv03.***********-dir: cram-md5.c:104-0 Authenticate NOT OK: wanted > >> c8/PW59kvg/vO/+n3E/gjD, got c8/PW59kvg/vO/+n3E/gj > >> > >> I grabbed these routines right from the cram-md5.c file in bacula to > >> see how it checks the cram-md5-reponse and verifies it. > > > > seems a bit short, should base64[23] be bigger? > > > > > I think it should be base64[22] - I jacked it up to [23] to see if > that was the case. Let me increase it again and see what I get... > > I tried it at [50], recompiled and still missing that last character: > > 2/+SCW/2d+/YM1/I08dRUD, got 2/+SCW/2d+/YM1/I08dRU > > Also that characters seems to always fall within ascii "A->D" range.
Add CR+NL to passwd? ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Bacula-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bacula-devel
