X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fshell-backends%2Fshellutil.c;h=0321061bd4c62970b2d494bbe67d7e66a39a7bb8;hb=4a87798893cb529d32cd77d50eab95cb361aa185;hp=246e93bc3e2ce6d9aadf567b0b81b39632d3cfb2;hpb=838643d5ad3d9555a15b4c800ff19f4f1405513c;p=openldap diff --git a/servers/slapd/shell-backends/shellutil.c b/servers/slapd/shell-backends/shellutil.c index 246e93bc3e..0321061bd4 100644 --- a/servers/slapd/shell-backends/shellutil.c +++ b/servers/slapd/shell-backends/shellutil.c @@ -1,18 +1,32 @@ +/* shellutil.c - common routines useful when building shell-based backends */ /* $OpenLDAP$ */ -/* - shellutil.c - common routines useful when building shell-based backends - for the standalone ldap server - - Copyright (c) 1995 Regents of the University of Michigan. - All rights reserved. - - Redistribution and use in source and binary forms are permitted - provided that this notice is preserved and that due credit is given - to the University of Michigan at Ann Arbor. The name of the University - may not be used to endorse or promote products derived from this - software without specific prior written permission. This software - is provided ``as is'' without express or implied warranty. -*/ +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2006 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* Portions Copyright (c) 1995 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ +/* ACKNOWLEDGEMENTS: + * This work was originally developed by the University of Michigan + * (as part of U-MICH LDAP). + */ #include "portable.h" @@ -171,21 +185,32 @@ parse_input( FILE *ifp, FILE *ofp, struct ldop *op ) op->ldop_dn = estrdup( args ); break; case IP_TYPE_SCOPE: - if (( op->ldop_srch.ldsp_scope = atoi( args )) != LDAP_SCOPE_BASE && + if ( lutil_atoi( &op->ldop_srch.ldsp_scope, args ) != 0 || + ( op->ldop_srch.ldsp_scope != LDAP_SCOPE_BASE && op->ldop_srch.ldsp_scope != LDAP_SCOPE_ONELEVEL && - op->ldop_srch.ldsp_scope != LDAP_SCOPE_SUBTREE ) { + op->ldop_srch.ldsp_scope != LDAP_SCOPE_SUBTREE ) ) + { write_result( ofp, LDAP_OTHER, NULL, "Bad scope" ); return( -1 ); } break; case IP_TYPE_ALIASDEREF: - op->ldop_srch.ldsp_aliasderef = atoi( args ); + if ( lutil_atoi( &op->ldop_srch.ldsp_aliasderef, args ) != 0 ) { + write_result( ofp, LDAP_OTHER, NULL, "Bad alias deref" ); + return( -1 ); + } break; case IP_TYPE_SIZELIMIT: - op->ldop_srch.ldsp_sizelimit = atoi( args ); + if ( lutil_atoi( &op->ldop_srch.ldsp_sizelimit, args ) != 0 ) { + write_result( ofp, LDAP_OTHER, NULL, "Bad size limit" ); + return( -1 ); + } break; case IP_TYPE_TIMELIMIT: - op->ldop_srch.ldsp_timelimit = atoi( args ); + if ( lutil_atoi( &op->ldop_srch.ldsp_timelimit, args ) != 0 ) { + write_result( ofp, LDAP_OTHER, NULL, "Bad time limit" ); + return( -1 ); + } break; case IP_TYPE_FILTER: op->ldop_srch.ldsp_filter = estrdup( args );