Ordinary differential equations - solution domain

I've got a question in my university home work in which I was asked to find the general solution for:

a. $$y'-(\tan x)y=1$$

b. $$y'+(\tan x)y=\cos^2(x)$$

and then for each one, determine whether a particular solution exists for the following boundary conditions:

1. $$y(\frac{\pi}{2})=3$$

2. $$y(\frac{\pi}{2})=0$$

Now after finding the general solutions:

a. $$y(x)=\tan(x)+\frac{c}{\cos(x)}$$

b. $$y(x)=\sin(x) \cos(x)+c \cdot \cos(x)$$

I think that there is no particular solution for either boundary condition for the 1st equation, since the solution is undefined for $$x=\frac{\pi}{2} +\pi k$$

Not sure if this is correct.

Also, I think that a particular solution exists for the 2nd equation only for the 2nd boundary condition, since it is correct for every constant $$c$$.

But, I don't know if the domain of the solution should be affected by the domain of the equation, because it has $$\tan(x)$$ in it.

So to sum up the question:

1. If the solution is undefined at the point of the boundary condition, does it always mean that there is no solution for this condition?

2. Should the solution be affected by the domain of the original equation itself? or should it be determined only considering the requirement for a continuous differentiable function and the boundary condition?

For a) we have that $$y(x)=\tan{(x)}+\frac{c}{\cos{(x)}}=\frac{\sin{(x)}}{\cos{(x)}}+\frac{c}{\cos{(x)}}=\frac{\sin{(x)}+c}{\cos{(x)}}$$ The limit as $$x\to\frac\pi2$$ \begin{align} \lim_{x\to\frac\pi2}y(x) &=\lim_{x\to\frac\pi2}\frac{\sin{(x)}+c}{\cos{(x)}}\\ \end{align} is not defined for $$c\ne-1$$ and taking $$c=-1$$ we have \begin{align} \lim_{x\to\frac\pi2}y(x) &=\lim_{x\to\frac\pi2}\frac{\sin{(x)}-1}{\cos{(x)}}\\ &=\lim_{x\to\frac\pi2}\frac{\cos{(x)}}{-\sin{(x)}}=0\\ \end{align} by using L'Hopitals rule. So the function $$y(x)=\begin{cases} 0 & x=\frac\pi2 \\ \frac{\sin{(x)}-1}{\cos{(x)}} & \text{otherwise} \\ \end{cases}$$ is then a solution to the differential equation with particular solution $$2$$.
Then, for part b) as identified $$y(\frac\pi2)=0$$ for all $$c$$ and hence the only valid particular solution is $$2$$.