| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** Copyright (c) 1999, 2000, 2001, 2002, 2003 | 2 ** Copyright (c) 1999, 2000, 2001, 2002, 2003 |
| 3 ** Adel I. Mirzazhanov. All rights reserved | 3 ** Adel I. Mirzazhanov. All rights reserved |
| 4 ** | 4 ** |
| 5 ** Redistribution and use in source and binary forms, with or without | 5 ** Redistribution and use in source and binary forms, with or without |
| 6 ** modification, are permitted provided that the following conditions | 6 ** modification, are permitted provided that the following conditions |
| 7 ** are met: | 7 ** are met: |
| 8 ** | 8 ** |
| 9 ** 1.Redistributions of source code must retain the above copyright notice, | 9 ** 1.Redistributions of source code must retain the above copyright notice, |
| 10 ** this list of conditions and the following disclaimer. | 10 ** this list of conditions and the following disclaimer. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 /* | 30 /* |
| 31 ** randpass.c - Random password generation module of PWGEN program | 31 ** randpass.c - Random password generation module of PWGEN program |
| 32 */ | 32 */ |
| 33 | 33 |
| 34 #include <stdio.h> | 34 #include <stdio.h> |
| 35 #include <stdlib.h> | 35 #include <stdlib.h> |
| 36 #include <time.h> | 36 #include <time.h> |
| 37 | 37 |
| 38 #include "base/rand_util.h" | 38 #include "base/rand_util.h" |
| 39 #include "owntypes.h" | |
| 40 #include "randpass.h" | 39 #include "randpass.h" |
| 41 #include "smbl.h" | 40 #include "smbl.h" |
| 42 | 41 |
| 43 /* | 42 /* |
| 44 ** gen_rand_pass - generates random password of specified type | 43 ** gen_rand_pass - generates random password of specified type |
| 45 ** INPUT: | 44 ** INPUT: |
| 46 ** char * - password string. | 45 ** char * - password string. |
| 47 ** int - minimum password length. | 46 ** int - minimum password length. |
| 48 ** int - maximum password length. | 47 ** int - maximum password length. |
| 49 ** unsigned int - password generation mode. | 48 ** unsigned int - password generation mode. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 max_weight = 0; | 135 max_weight = 0; |
| 137 max_weight_element_number = 0; | 136 max_weight_element_number = 0; |
| 138 return (0); | 137 return (0); |
| 139 } | 138 } |
| 140 | 139 |
| 141 /* | 140 /* |
| 142 ** is_restricted_symbol - detcts if symbol is restricted rigt now | 141 ** is_restricted_symbol - detcts if symbol is restricted rigt now |
| 143 ** INPUT: | 142 ** INPUT: |
| 144 ** char - symbol. | 143 ** char - symbol. |
| 145 ** OUTPUT: | 144 ** OUTPUT: |
| 146 ** int - 0 - not restricted | 145 ** bool - false - not restricted |
| 147 ** 1 - restricted | 146 ** true - restricted |
| 148 ** NOTES: | 147 ** NOTES: |
| 149 ** none. | 148 ** none. |
| 150 */ | 149 */ |
| 151 int | 150 bool |
| 152 is_restricted_symbol (char symbol) | 151 is_restricted_symbol (char symbol) |
| 153 { | 152 { |
| 154 int j = 0; | 153 int j = 0; |
| 155 for (j = 0; j <= 93 ; j++) | 154 for (j = 0; j <= 93 ; j++) |
| 156 if (symbol == smbl[j].ch) | 155 if (symbol == smbl[j].ch) |
| 157 if ((S_RS & smbl[j].type) > 0) | 156 if ((S_RS & smbl[j].type) > 0) |
| 158 return(1); | 157 return(true); |
| 159 return(0); | 158 return(false); |
| 160 } | 159 } |
| OLD | NEW |