STATIC_ROUTINE int MdsLoginVMS(SOCKET sock, char *username, char *password) { struct descrip loginget_arg; struct descrip loginpwd_arg; struct descrip pwd_arg; struct descrip ansarg; int status; ansarg.ptr = 0; status = MdsValue(sock, LOGINREQUEST, MakeDescrip(&loginget_arg,DTYPE_CSTRING,0,0,LOGINGETP1), &ansarg, NULL); if (status & 1) { if (ansarg.ptr && ansarg.dtype == DTYPE_CHAR) { char alg = *(char *)ansarg.ptr; free(ansarg.ptr); status = MdsValue(sock, LOGINREQUEST, MakeDescrip(&loginget_arg,DTYPE_CSTRING,0,0,LOGINGETP2), &ansarg, NULL); if (status & 1) { if (ansarg.ptr && ansarg.dtype == DTYPE_SHORT) { struct dscr { short length; char dtype; char class; void *pointer;}; int hash[2]; int i; struct dscr hashd = {8, 9, 1, 0}; struct dscr pwdd = {0,14,1,0}; struct dscr userd = {0,14,1,0}; short salt = *(short *)ansarg.ptr; free(ansarg.ptr); ansarg.ptr = 0; hashd.pointer = hash; pwdd.length = strlen(password); pwdd.pointer = strcpy((char *)malloc(pwdd.length+1),password); userd.length = strlen(username); userd.pointer = strcpy((char *)malloc(userd.length+1),username); for (i=0;i<pwdd.length;i++) ((char *)pwdd.pointer)[i] = __toupper(((char *)pwdd.pointer)[i]); for (i=0;i<userd.length;i++) ((char *)userd.pointer)[i] = __toupper(((char *)userd.pointer)[i]); status = Lgihpwd(&hashd,&pwdd,alg,salt,&userd); if (status & 1) { int two = 2; status = MdsValue(sock, LOGINREQUEST, MakeDescrip(&loginpwd_arg,DTYPE_CSTRING,0,0,LOGINPWD), MakeDescrip(&pwd_arg,DTYPE_LONG,1,&two,hash), &ansarg, NULL); } else printf("Login error: Error checking password\n"); } else { if (ansarg.ptr) { free(ansarg.ptr); ansarg.ptr = 0; } printf("Login error: Unrecognized response from server\n"); status = 0; } }
//------------------------------------------------------------------------- // helper routine //------------------------------------------------------------------------- static void str_upcase( struct descriptor *in, struct descriptor *out ) { int i; for( i = 0; i < in->length; i++ ) out->pointer[i] = __toupper( in->pointer[i] ); }
char *strnupper (char *str, size_t n) { char *p; for (p = str; n--; ++p) *p = __toupper(*p); return(str); }
char *strupper (char *str) { char *p; for (p = str; *p != '\0'; ++p) *p = __toupper(*p); return(str); }
DECL_EXTERN_API(BOOLEAN, StringToUpperW, IN OUT LPWSTR lpStr) { for (; *lpStr; *lpStr++) { *lpStr = __toupper(*lpStr); } return TRUE; }
static __skipspec_t __skip_str(__skipspec_t ss, const char *str) { dt_dow_t tmp; if ((tmp = __parse_wd(str)) != DT_MIRACLEDAY) { ss = __skip_dow(ss, tmp); } else { int s1 = __toupper(str[0]); int s2 = __toupper(str[1]); if (ILEA(s1, s2) == ILEA('S', 'S')) { /* weekend */ ss |= SKIP_SAT; ss |= SKIP_SUN; } } return ss; }
LOCAL BOOL dirListPattern( char *pat, char *path ) { const char matchOne = '?'; const char matchMany = '*'; BOOL ret = TRUE; char *pPat = pat; char *pNext; for (pNext = path; *pNext != EOS; pNext++) { if (*pPat == matchOne) { pPat++; } else if (*pPat == matchMany) { if (pNext[0] == '.') { ret = FALSE; break; } if (__toupper(pPat[0]) == __toupper(pNext[1])) { pPat++; } else if (__toupper(pPat[1]) == __toupper(pNext[0])) { pPat += 2; } else { continue; } } else if (__toupper(*pPat) != __toupper(*pNext)) { ret = FALSE; } else { pPat++; } } if (ret == TRUE) { if (!((pPat[0] == EOS) || ((pPat[0] == matchMany) && (pPat[1] == EOS)))) { ret = FALSE; } } return ret; }
static dt_dow_t __parse_wd(const char *str) { #define ILEA(a, b) (((a) << 8) | (b)) int s1 = __toupper(str[0]); int s2 = __toupper(str[1]); switch (ILEA(s1, s2)) { case ILEA('M', 'O'): case ILEA('M', 0): /* monday */ return DT_MONDAY; case ILEA('T', 'U'): /* tuesday */ return DT_TUESDAY; case ILEA('W', 'E'): case ILEA('W', 0): /* wednesday */ return DT_WEDNESDAY; case ILEA('T', 'H'): /* thursday */ return DT_THURSDAY; case ILEA('F', 'R'): case ILEA('F', 0): /* friday */ return DT_FRIDAY; case ILEA('S', 'A'): case ILEA('A', 0): /* saturday */ return DT_SATURDAY; case ILEA('S', 'U'): case ILEA('S', 0): /* sunday */ return DT_SUNDAY; default: return DT_MIRACLEDAY; } }
static const char *hex2string(unsigned long *hex, const char *src_ptr) { unsigned long res = 0; const char *src = src_ptr; for (; isxdigit(*src); src++) { if (isdigit(*src)) res = res * 16 + ((*src) - '0'); else res = res * 16 + (__toupper(*src) - 'A' + 10); } *hex = res; return(src); }
static int fip_info_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { int i; unsigned long cnt; const char *ptr = buffer, *end = buffer + count; memset(fip_keys, 0, INPUT_TABLE_SIZE); fip_key_cnt = 0; /* Parse the values */ for (cnt = i = 0; (i < INPUT_TABLE_SIZE/sizeof(unsigned long)) && (cnt < count); i++) { for (; (!isdigit(*ptr)) && (ptr < end); ptr++); /* skip leading unwanted stuff */ if (ptr >= end) break; /* no more */ else if ((*ptr == '0') && (__toupper(*(ptr + 1)) == 'X')) ptr = hex2string(&fip_keys[i], ptr + 2); else ptr = dec2string(&fip_keys[i], ptr); } fip_key_cnt = i; return(count); }
int toupper(int c) { return __toupper(c); }
static int match_wild(char *candidate, char *pattern) { char *cand1 = candidate; short cand1_len = strlen(candidate); char *cand2 = cand1; short cand2_len = 0; char *pat1 = pattern; short pat1_len = strlen(pattern); char *pat2 = pat1; char pc; int true; true = 1; while (true) { if (--pat1_len < 0) { if (cand1_len == 0) return 1; else { if (--cand2_len < 0) return 0; else { cand2++; cand1 = cand2; cand1_len = cand2_len; pat1 = pat2; } } } else { if ((pc = *pat1++) == '*') { if (pat1_len == 0) return 1; cand2 = cand1; cand2_len = cand1_len; pat2 = pat1; } else { if (--cand1_len < 0) return 0; if (__toupper(*cand1) != __toupper(pc)) { cand1++; if (pc != '%') { if (--cand2_len < 0) return 0; else { cand2++; cand1 = cand2; cand1_len = cand2_len; pat1 = pat2; } } } else cand1++; } } } return 0; }
wint_t towupper(wint_t wc) { return (__toupper(wc)); }