/* NTLM code.
Copyright (C) 2005 Free Software Foundation, Inc.
- Donated by Daniel Stenberg.
+ Contributed by Daniel Stenberg.
This file is part of GNU Wget.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
In addition, as a special exception, the Free Software Foundation
gives permission to link the code of its release of Wget with the
*/
-/* -- WIN32 approved -- */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
beginning of the NTLM message, in bytes.
*/
-/* return 1 on success, 0 otherwise */
-int
+/* return true on success, false otherwise */
+bool
ntlm_input (struct ntlmdata *ntlm, const char *header)
{
if (0 != strncmp (header, "NTLM", 4))
- return 0;
+ return false;
header += 4;
while (*header && ISSPACE(*header))
size = base64_decode (header, buffer);
if (size < 0)
- return 0; /* malformed base64 from server */
+ return false; /* malformed base64 from server */
ntlm->state = NTLMSTATE_TYPE2; /* we got a type-2 */
if (ntlm->state >= NTLMSTATE_TYPE1)
{
DEBUGP (("Unexpected empty NTLM message.\n"));
- return 0; /* this is an error */
+ return false; /* this is an error */
}
DEBUGP (("Empty NTLM message, starting transaction.\n"));
ntlm->state = NTLMSTATE_TYPE1; /* we should sent away a type-1 */
}
- return 1;
+ return true;
}
/*
/* this is for creating ntlm header output */
char *
ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
- int *ready)
+ bool *ready)
{
const char *domain=""; /* empty */
const char *host=""; /* empty */
server, which is for a plain host or for a HTTP proxy */
char *output;
- *ready = 0;
+ *ready = false;
/* not set means empty */
if(!user)
output = concat_strings ("NTLM ", base64, (char *) 0);
ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */
- *ready = 1;
+ *ready = true;
}
break;
case NTLMSTATE_TYPE3:
/* connection is already authenticated,
* don't send a header in future requests */
- *ready = 1;
+ *ready = true;
output = NULL;
break;
}