-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GSoC IPPServer Functionality #120 #121 #122 #139
base: master
Are you sure you want to change the base?
Changes from 6 commits
f43e6c4
ddb287f
81e6635
1321fe3
9446f88
8aaba39
b86b9a8
69cec5c
abb1c46
9cecef0
25873ac
83b39b3
c976be5
faf04bf
6a1629e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ _ippFileParse( | |
{ | ||
_ippVarsExpand(v, value, temp, sizeof(value)); | ||
_ippVarsSet(v, name, value); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
|
@@ -624,11 +624,71 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */ | |
break; | ||
|
||
case IPP_TAG_STRING : | ||
return (ippSetOctetString(ipp, attr, element, value, (int)strlen(value))); | ||
{ | ||
if(value[0]=='<') /* Input is binary(in form of hex) values*/ | ||
{ | ||
memmove(value, value+1, strlen(value)); /* Eliminate the '<' sign */ | ||
char value_concat[50000]; /* Concatenated string with hexadecimal values without whitespace */ | ||
int starting_line_number = f->linenum; | ||
while(value[strlen(value)-1] != '>') | ||
{ | ||
strcat(value_concat,value); | ||
if (!_ippFileReadToken(f, value, sizeof(value))) | ||
{ | ||
report_error(f, v, user_data, "hexadecimal value not terminated starting line %d of \"%s\".", starting_line_number, f->filename); | ||
return (0); | ||
} | ||
} | ||
value[(strlen(value)-1)]='\0'; /* Eliminate the last '>' sign */ | ||
strcat(value_concat,value); /* Final concatenation for hexadecimal value to be complete*/ | ||
int i; /* Iterating variable*/ | ||
for(i=0;i<strlen(value_concat);i++) /* Sanity Check*/ | ||
{ | ||
if(!(value_concat[i] >= '0' && value_concat[i]<= '9') || (value_concat[i]>='a' && value_concat[i]<='f')) | ||
{ | ||
report_error(f, v, user_data, "Bad hexadecimal value \"%s\" on line %d of \"%s\".", value_concat, starting_line_number, f->filename); | ||
return (0); | ||
} | ||
} | ||
return (ippSetOctetString(ipp, attr, element, value_concat, (int)strlen(value_concat))); | ||
} | ||
else | ||
{ | ||
return (ippSetOctetString(ipp, attr, element, value, (int)strlen(value))); /* If a quoted string like "..", pass it on */ | ||
} | ||
|
||
} | ||
|
||
break; | ||
|
||
case IPP_TAG_TEXTLANG : | ||
{ | ||
(*attr)->values[element].string.text = _cupsStrAlloc(value); | ||
if (!_ippFileReadToken(f, value, sizeof(value))) | ||
{ | ||
report_error(f, v, user_data, "No Language Data in line %d of \"%s\".", f->linenum, f->filename); | ||
return (0); | ||
} | ||
memmove(value, value+1, strlen(value)); | ||
value[strlen(value)-1]='\0'; /* Purge parenthesis */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the syntax is:
then we need to verify that the token we've read starts and ends with "(" and ")". |
||
(*attr)->values[element].string.language = _cupsStrAlloc(value); | ||
|
||
} | ||
break; | ||
case IPP_TAG_NAMELANG : | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the same code for IPP_TAG_NAMELANG and IPP_TAG_TEXTLANG (with the two case statements together feeding into the same code). |
||
(*attr)->values[element].string.text = _cupsStrAlloc(value); | ||
if (!_ippFileReadToken(f, value, sizeof(value))) | ||
{ | ||
report_error(f, v, user_data, "No Language Data in line %d of \"%s\".", f->linenum, f->filename); | ||
return (0); | ||
} | ||
memmove(value, value+1, strlen(value)); | ||
value[strlen(value)-1]='\0'; /* Purge parenthesis */ | ||
(*attr)->values[element].string.language = _cupsStrAlloc(value); | ||
|
||
} | ||
break; | ||
case IPP_TAG_TEXT : | ||
case IPP_TAG_NAME : | ||
case IPP_TAG_KEYWORD : | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parse the value string into a buffer, don't copy/move stuff around. The buffer just needs to be 32767 bytes, e.g.: