Example #1
0
int main(int argc, char **argv)
{
  int fd;
  des_cblock key;
  char *tty;
  tty = ttyname(0);
  if (!tty || strcmp(tty, "/dev/console"))
    {
      fprintf(stderr, insecure);
      exit(1);
    }
  fd = open(srvtab, O_WRONLY|O_APPEND, 0);
  if (!fd)
    {
      perror(srvtab);
      exit(1);
    }
  if (sizeof(string) - 1 != 13)
    {
      fprintf(stderr, "string size bad\n");
      exit(1);
    }
  des_read_password(key, "Enter SMS update password: "******"\nKey written.\n");
  exit(0);
}
Example #2
0
int main(int argc, char *argv[])
	{
	DES_cblock k,k1;
	int i;

	TINYCLR_SSL_PRINTF("read passwd\n");
	if ((i=des_read_password(&k,"Enter password:"******"password = "******"%02x ",k[i]);
		}
	else
		TINYCLR_SSL_PRINTF("error %d\n",i);
	TINYCLR_SSL_PRINTF("\n");
	TINYCLR_SSL_PRINTF("read 2passwds and verify\n");
	if ((i=des_read_2passwords(&k,&k1,
		"Enter verified password:"******"password1 = ");
		for (i=0; i<8; i++)
			TINYCLR_SSL_PRINTF("%02x ",k[i]);
		TINYCLR_SSL_PRINTF("\n");
		TINYCLR_SSL_PRINTF("password2 = ");
		for (i=0; i<8; i++)
			TINYCLR_SSL_PRINTF("%02x ",k1[i]);
		TINYCLR_SSL_PRINTF("\n");
		TINYCLR_SSL_EXIT(1);
		}
	else
		{
		TINYCLR_SSL_PRINTF("error %d\n",i);
		TINYCLR_SSL_EXIT(0);
		}
#ifdef LINT
	return(0);
#endif
	}
Example #3
0
File: rpw.c Project: 274914765/C
int main (int argc, char *argv[])
{
    DES_cblock k, k1;

    int i;

    printf ("read passwd\n");
    if ((i = des_read_password (&k, "Enter password:"******"password = "******"%02x ", k[i]);
    }
    else
        printf ("error %d\n", i);
    printf ("\n");
    printf ("read 2passwds and verify\n");
    if ((i = des_read_2passwords (&k, &k1, "Enter verified password:"******"password1 = ");
        for (i = 0; i < 8; i++)
            printf ("%02x ", k[i]);
        printf ("\n");
        printf ("password2 = ");
        for (i = 0; i < 8; i++)
            printf ("%02x ", k1[i]);
        printf ("\n");
        exit (1);
    }
    else
    {
        printf ("error %d\n", i);
        exit (0);
    }
#ifdef LINT
    return (0);
#endif
}
Example #4
0
/*ARGSUSED */
static int
passwd_to_key(
    char *user,
    char *instance,
    char *realm,
    char *passwd,
    C_Block key
    )
{
#ifdef NOENCRYPTION
    if (!passwd)
        placebo_read_password(key, "Password: "******"Password: "******"Trying next_string_to_key[%d]\n",in_tkt_decrypt_again);
    } else
        --in_tkt_decrypt_again;

    /* 
     *  If the principal is known to be in the local realm, don't even bother
     *  to attempt decryptions with alternative string to key algorithms (i.e.
     *  we presumably aren't schizophrenic with respect to our own string to
     *  key function).  This is simply an optimization to avoid extra useless
     *  work when a bad password has been supplied in the common case.
     */
    /* THIS IS WRONG!!!!!
     * if (strcmp(realm, KRB_REALM) == 0)
     *   in_tkt_decrypt_again = 0; 
     */
    /*
     *  If there are no more string to key algorithms to try, zero the password
     *  string now so that krb_get_in_tkt() doesn't have to call us back since
     *  it can't distinguish this case from one when the password function
     *  doesn't support iteration at all.
     */
    if (in_tkt_decrypt_again == 0) {
        bzero(key_string, sizeof (key_string));
        have_key_string = 0;
    }
#else /* OLDSTRTOKEY */
    // back to the original MIT code
    if (passwd)
        string_to_key(passwd, key);
    else {
        des_read_password(key, "Password: ", 0);
    }
#endif /* OLDSTRTOKEY */
  
#endif /* !NOENCRYPTION */
    return (0);
}